]> www.infradead.org Git - users/hch/configfs.git/commitdiff
bcachefs: Fix incorrect error handling found_btree_node_is_readable()
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 6 Jun 2024 01:16:29 +0000 (21:16 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 10 Jun 2024 17:17:15 +0000 (13:17 -0400)
error handling here is slightly odd, which is why we were accidently
calling evict() on an error pointer

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_node_scan.c

index 45cb8149d374c2878e8c607282ca4e5e7875f063..2cb0442f6cc9055915b62ec1bc658a597754fb1a 100644 (file)
@@ -72,10 +72,11 @@ static bool found_btree_node_is_readable(struct btree_trans *trans,
 
        struct btree *b = bch2_btree_node_get_noiter(trans, &k.k, f->btree_id, f->level, false);
        bool ret = !IS_ERR_OR_NULL(b);
-       if (ret) {
-               f->sectors_written = b->written;
-               six_unlock_read(&b->c.lock);
-       }
+       if (!ret)
+               return ret;
+
+       f->sectors_written = b->written;
+       six_unlock_read(&b->c.lock);
 
        /*
         * We might update this node's range; if that happens, we need the node