]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Illumos 5422 - preserve AVL invariants in dn_dbufs
authorAlex Reece <alex@delphix.com>
Wed, 6 May 2015 17:08:25 +0000 (03:08 +1000)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 11 May 2015 22:09:29 +0000 (15:09 -0700)
Author: Alex Reece <alex@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <paul.dagnelie@delphix.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Albert Lee <trisk@nexenta.com>
Approved by: Dan McDonald <danmcd@omniti.com>

References:
  https://www.illumos.org/issues/5422
  https://github.com/illumos/illumos-gate/commit/a846f19

Ported-by: Chris Dunlop <chris@onthe.net.au>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3381

module/zfs/dnode.c

index e1ea165aab0db08df83161120be95ce0762182c1..6865cd01e09d085f9cf1ce73ad3a00608e392bb1 100644 (file)
@@ -83,16 +83,14 @@ dbuf_compare(const void *x1, const void *x2)
                return (1);
        }
 
-       if (d1->db_state < d2->db_state) {
+       if (d1->db_state == DB_SEARCH) {
+               ASSERT3S(d2->db_state, !=, DB_SEARCH);
                return (-1);
-       }
-       if (d1->db_state > d2->db_state) {
+       } else if (d2->db_state == DB_SEARCH) {
+               ASSERT3S(d1->db_state, !=, DB_SEARCH);
                return (1);
        }
 
-       ASSERT3S(d1->db_state, !=, DB_SEARCH);
-       ASSERT3S(d2->db_state, !=, DB_SEARCH);
-
        if ((uintptr_t)d1 < (uintptr_t)d2) {
                return (-1);
        }