From 7224c67fea3c427ab0d5bafb6d7fba32a7a592d9 Mon Sep 17 00:00:00 2001 From: Alex Reece Date: Thu, 7 May 2015 03:08:25 +1000 Subject: Illumos 5422 - preserve AVL invariants in dn_dbufs Author: Alex Reece Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Reviewed by: Josef 'Jeff' Sipek Reviewed by: Albert Lee Approved by: Dan McDonald References: https://www.illumos.org/issues/5422 https://github.com/illumos/illumos-gate/commit/a846f19 Ported-by: Chris Dunlop Signed-off-by: Brian Behlendorf Closes #3381 --- module/zfs/dnode.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c index e1ea165aa..6865cd01e 100644 --- a/module/zfs/dnode.c +++ b/module/zfs/dnode.c @@ -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); } -- cgit v1.2.3