diff options
author | Daniel Hill <daniel@gluo.nz> | 2023-01-06 21:11:07 +1300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:52 -0400 |
commit | 3482dd6a250397fe1dc088a16bc9e50d72f217e6 (patch) | |
tree | 8edfedcc8a1ae36e890537e7a41a6918c5fc7d02 /fs/bcachefs/io.c | |
parent | 0093b9e9704cc932363c66b2b072b762771ffe1f (diff) | |
download | lwn-3482dd6a250397fe1dc088a16bc9e50d72f217e6.tar.gz lwn-3482dd6a250397fe1dc088a16bc9e50d72f217e6.zip |
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.c | 7 |
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; |