summaryrefslogtreecommitdiffstats
path: root/sys/cddl
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2014-12-18 23:45:26 +0000
committerdelphij <delphij@FreeBSD.org>2014-12-18 23:45:26 +0000
commit2d307c57cf4bf5e3da114ec173eede0e72761653 (patch)
treea84ddbdb1080408a6015a50712803bf1b8f75841 /sys/cddl
parent81d815bf1802965c8d055ba461e677c7d068464e (diff)
downloadFreeBSD-src-2d307c57cf4bf5e3da114ec173eede0e72761653.zip
FreeBSD-src-2d307c57cf4bf5e3da114ec173eede0e72761653.tar.gz
MFV r275914:
As of r270383, the dbuf_compare comparator compares the dbuf attributes in the following order: db_level (indirect level) db_blkid (block number) db_state (current state) the address of the element Because db_state is being considered before the element's state, changing of db_state would affect balancedness of the AVL tree, even when the address of element compares differently. For instance, in dbuf_create, db_state may be altered after the node is inserted into the AVL tree and may break AVL tree balancedness. Instead of using db_state as a comparision critera (introduced in r270383), consider it only when we are doing a lookup, that is one of the two dbuf pointers contains DB_SEARCH. Illumos issue: 5422 preserve AVL invariants in dn_dbufs MFC after: 2 weeks
Diffstat (limited to 'sys/cddl')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
index 66552c3..665165a 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
@@ -81,16 +81,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);
}
OpenPOWER on IntegriCloud