projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e0eaf86
)
bcachefs: Fix bch2_btree_path_up_until_good_node()
author
Kent Overstreet
<kent.overstreet@linux.dev>
Tue, 27 Sep 2022 22:56:57 +0000
(18:56 -0400)
committer
Kent Overstreet
<kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:42 +0000
(17:09 -0400)
There was a rare bug when path->locks_want was nonzero, but not
BTREE_MAX_DEPTH, where we'd return on a valid node that wasn't locked -
oops.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_iter.c
patch
|
blob
|
history
diff --git
a/fs/bcachefs/btree_iter.c
b/fs/bcachefs/btree_iter.c
index 67a1e0d70ed92542b7ab22114f9a386435d5e8d1..7ea29724985067281bdeb81cae6a27f1348b1f4d 100644
(file)
--- a/
fs/bcachefs/btree_iter.c
+++ b/
fs/bcachefs/btree_iter.c
@@
-1030,7
+1030,7
@@
static inline unsigned btree_path_up_until_good_node(struct btree_trans *trans,
int check_pos)
{
unsigned i, l = path->level;
-
+again:
while (btree_path_node(path, l) &&
!btree_path_good_node(trans, path, l, check_pos))
__btree_path_set_level_up(trans, path, l++);
@@
-1039,9
+1039,11
@@
static inline unsigned btree_path_up_until_good_node(struct btree_trans *trans,
for (i = l + 1;
i < path->locks_want && btree_path_node(path, i);
i++)
- if (!bch2_btree_node_relock(trans, path, i))
+ if (!bch2_btree_node_relock(trans, path, i))
{
while (l <= i)
__btree_path_set_level_up(trans, path, l++);
+ goto again;
+ }
return l;
}