From 13b6163f46567006b696360b431abf4633c3d7e6 Mon Sep 17 00:00:00 2001 From: Paul Dagnelie Date: Tue, 13 Oct 2020 10:56:03 -0700 Subject: [PATCH] Fix incorrect deletion order in range_tree_add_impl gap case Signed-off-by: Paul Dagnelie --- module/zfs/range_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/range_tree.c b/module/zfs/range_tree.c index 2ce0139c9137..5219fd079b73 100644 --- a/module/zfs/range_tree.c +++ b/module/zfs/range_tree.c @@ -314,7 +314,6 @@ range_tree_add_impl(void *arg, uint64_t start, uint64_t size, uint64_t fill) return; } - zfs_btree_remove(&rt->rt_root, rs); if (rt->rt_ops != NULL && rt->rt_ops->rtop_remove != NULL) rt->rt_ops->rtop_remove(rt, rs, rt->rt_arg); @@ -326,6 +325,7 @@ range_tree_add_impl(void *arg, uint64_t start, uint64_t size, uint64_t fill) end = MAX(end, rend); size = end - start; + zfs_btree_remove(&rt->rt_root, rs); range_tree_add_impl(rt, start, size, fill); return; }