summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-03-18 16:46:46 +0100
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:08:37 +0200
commit6d61724b2ba1836e4e1f5f8755cb2278d4eae1a0 (patch)
treefaf56cdfab6f1417f641899a2e941ec766c47c85 /fs/bcachefs/io.c
parentbcachefs: BCH_FEATURE_new_extent_overwrite is now required (diff)
downloadlinux-6d61724b2ba1836e4e1f5f8755cb2278d4eae1a0.tar.xz
linux-6d61724b2ba1836e4e1f5f8755cb2278d4eae1a0.zip
bcachefs: Shut down quicker
Internal writes (i.e. copygc/rebalance operations) shouldn't be blocking on the allocator when we're going RO. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to '')
-rw-r--r--fs/bcachefs/io.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index 2ec7203e5824..3dcb166afa23 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -1070,6 +1070,12 @@ again:
BKEY_EXTENT_U64s_MAX))
goto flush_io;
+ if ((op->flags & BCH_WRITE_FROM_INTERNAL) &&
+ percpu_ref_is_dying(&c->writes)) {
+ ret = -EROFS;
+ goto err;
+ }
+
wp = bch2_alloc_sectors_start(c,
op->target,
op->opts.erasure_code,