bcachefs: Minor transaction restart handling fix
authorKent Overstreet <kent.overstreet@gmail.com>
Thu, 18 Aug 2022 02:17:08 +0000 (22:17 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:38 +0000 (17:09 -0400)
 - fsck_inode_rm() wasn't returning BCH_ERR_transaction_restart_nested
 - change bch2_trans_verify_not_restarted() to call panic() - we don't
   want these errors to be missed

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

index 88b2ed1d508a2569e7ff528b09a514acf9e259cf..95bc71dd87afacb3ff54bd0654f12c1b2ebf140e 100644 (file)
@@ -3289,10 +3289,10 @@ u32 bch2_trans_begin(struct btree_trans *trans)
 
 void bch2_trans_verify_not_restarted(struct btree_trans *trans, u32 restart_count)
 {
-       bch2_trans_inconsistent_on(trans_was_restarted(trans, restart_count), trans,
-               "trans->restart_count %u, should be %u, last restarted by %ps\n",
-               trans->restart_count, restart_count,
-               (void *) trans->last_restarted_ip);
+       if (trans_was_restarted(trans, restart_count))
+               panic("trans->restart_count %u, should be %u, last restarted by %pS\n",
+                     trans->restart_count, restart_count,
+                     (void *) trans->last_restarted_ip);
 }
 
 static void bch2_trans_alloc_paths(struct btree_trans *trans, struct bch_fs *c)
index ef2e3286458075902fd3bc95dcbe9c3518ed8b1e..1a841146e379fb129ed2ce5de1c55ea147aa88a8 100644 (file)
@@ -290,7 +290,7 @@ err:
        if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
                goto retry;
 
-       return ret;
+       return ret ?: -BCH_ERR_transaction_restart_nested;
 }
 
 static int __remove_dirent(struct btree_trans *trans, struct bpos pos)
@@ -914,7 +914,7 @@ static int check_inode(struct btree_trans *trans,
                bch2_fs_lazy_rw(c);
 
                ret = fsck_inode_rm(trans, u.bi_inum, iter->pos.snapshot);
-               if (ret)
+               if (ret && !bch2_err_matches(ret, BCH_ERR_transaction_restart))
                        bch_err(c, "error in fsck: error while deleting inode: %s",
                                bch2_err_str(ret));
                return ret;