summaryrefslogtreecommitdiff
path: root/fs/bcachefs/io.c
diff options
context:
space:
mode:
authorDaniel Hill <daniel@gluo.nz>2023-01-06 11:11:07 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:52 +0300
commit3482dd6a250397fe1dc088a16bc9e50d72f217e6 (patch)
tree8edfedcc8a1ae36e890537e7a41a6918c5fc7d02 /fs/bcachefs/io.c
parent0093b9e9704cc932363c66b2b072b762771ffe1f (diff)
downloadlinux-3482dd6a250397fe1dc088a16bc9e50d72f217e6.tar.xz
bcachefs: don't block reads if we're promoting
The promote path calls data_update_init() and now that we take locks here, there's potential for promote to block our read path, just error when we can't take the lock instead of blocking. Signed-off-by: Daniel Hill <daniel@gluo.nz> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/io.c')
-rw-r--r--fs/bcachefs/io.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index 1436863fe418..6f7e4dac4268 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -2023,6 +2023,13 @@ static struct promote_op *__promote_alloc(struct btree_trans *trans,
.write_flags = BCH_WRITE_ALLOC_NOWAIT|BCH_WRITE_CACHED,
},
btree_id, k);
+ if (ret == -BCH_ERR_nocow_lock_blocked) {
+ ret = rhashtable_remove_fast(&c->promote_table, &op->hash,
+ bch_promote_params);
+ BUG_ON(ret);
+ goto err;
+ }
+
BUG_ON(ret);
op->write.op.end_io = promote_done;