Skip to content

Commit 1c8cc24

Browse files
author
Kent Overstreet
committed
bcachefs: Fix incorrect error handling found_btree_node_is_readable()
error handling here is slightly odd, which is why we were accidently calling evict() on an error pointer Signed-off-by: Kent Overstreet <[email protected]>
1 parent 161f73c commit 1c8cc24

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fs/bcachefs/btree_node_scan.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ static bool found_btree_node_is_readable(struct btree_trans *trans,
7272

7373
struct btree *b = bch2_btree_node_get_noiter(trans, &k.k, f->btree_id, f->level, false);
7474
bool ret = !IS_ERR_OR_NULL(b);
75-
if (ret) {
76-
f->sectors_written = b->written;
77-
six_unlock_read(&b->c.lock);
78-
}
75+
if (!ret)
76+
return ret;
77+
78+
f->sectors_written = b->written;
79+
six_unlock_read(&b->c.lock);
7980

8081
/*
8182
* We might update this node's range; if that happens, we need the node

0 commit comments

Comments
 (0)