]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Always clear should_be_locked in bch2_trans_begin()
authorKent Overstreet <kent.overstreet@gmail.com>
Thu, 24 Feb 2022 18:27:31 +0000 (13:27 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:25 +0000 (17:09 -0400)
bch2_trans_begin() invalidates all iterators, until they're revalidated
by calling peek() or traverse().

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/btree_iter.c

index 1015e89d2d683c6dc57d724e1053409dda88b493..8aacaa05fc144bf71de439fb0223f721ba71dc68 100644 (file)
@@ -2988,6 +2988,8 @@ void bch2_trans_begin(struct btree_trans *trans)
        }
 
        trans_for_each_path(trans, path) {
+               path->should_be_locked = false;
+
                /*
                 * XXX: we probably shouldn't be doing this if the transaction
                 * was restarted, but currently we still overflow transaction
@@ -2996,7 +2998,7 @@ void bch2_trans_begin(struct btree_trans *trans)
                if (!path->ref && !path->preserve)
                        __bch2_path_free(trans, path);
                else
-                       path->preserve = path->should_be_locked = false;
+                       path->preserve = false;
        }
 
        bch2_trans_cond_resched(trans);