bcachefs: BTREE_INSERT_LAZY_RW is only for recovery path
authorKent Overstreet <kent.overstreet@gmail.com>
Mon, 10 Jan 2022 01:55:58 +0000 (20:55 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:22 +0000 (17:09 -0400)
BTREE_INSERT_LAZY_RW shouldn't do anything after the filesystem has
finished starting up - otherwise, it might interfere with going
read-only as part of shutting down.

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

index 41403942133a941dc6a336dbebb7243427bc39d8..aa5b7960e2145330f123ba85230d0c54833a71a5 100644 (file)
@@ -841,7 +841,8 @@ bch2_trans_commit_get_rw_cold(struct btree_trans *trans)
        struct bch_fs *c = trans->c;
        int ret;
 
-       if (likely(!(trans->flags & BTREE_INSERT_LAZY_RW)))
+       if (likely(!(trans->flags & BTREE_INSERT_LAZY_RW)) ||
+           test_bit(BCH_FS_STARTED, &c->flags))
                return -EROFS;
 
        bch2_trans_unlock(trans);