]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bcachefs: Fix a locking bug in fsck
authorKent Overstreet <kent.overstreet@gmail.com>
Sat, 21 Mar 2020 18:47:00 +0000 (14:47 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:37 +0000 (17:08 -0400)
This works around a btree locking issue - we can't be holding read locks
while taking write locks, which currently means we can't have live
iterators holding read locks at commit time.

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

index 902c8da9dc15a259ae44415782808836a4b8b9f2..936e6366cb0470da857456b7d4f7e07097881ab2 100644 (file)
@@ -478,7 +478,8 @@ static int check_extents(struct bch_fs *c)
        bch_verbose(c, "checking extents");
 
        iter = bch2_trans_get_iter(&trans, BTREE_ID_EXTENTS,
-                                  POS(BCACHEFS_ROOT_INO, 0), 0);
+                                  POS(BCACHEFS_ROOT_INO, 0),
+                                  BTREE_ITER_INTENT);
 retry:
        for_each_btree_key_continue(iter, 0, k, ret) {
                if (bkey_cmp(prev.p, bkey_start_pos(k.k)) > 0) {