summaryrefslogtreecommitdiff
path: root/fs/bcachefs/io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-03-19 20:01:06 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:58 +0300
commitdc6274bcb87dbf50c62d9dbacba770bae2f10279 (patch)
treea420763529e7ddfc5d2a8fbc1543426f231e1c9b /fs/bcachefs/io.c
parentac77810cb4ffd16976487d787e2f81ba9cb5fd0c (diff)
downloadlinux-dc6274bcb87dbf50c62d9dbacba770bae2f10279.tar.xz
bcachefs: Fix nocow write path closure bug
With regular waitlists, we need to ensure we always call finish_wait(). With closures, the equivalent is that we need to call closure_sync() before returning with a stack-allocated closure. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/io.c')
-rw-r--r--fs/bcachefs/io.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index ad22557197a6..cc2dfcf16dee 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -453,13 +453,13 @@ retry:
opts.data_replicas,
opts.data_replicas,
RESERVE_none, 0, &cl, &wp);
- if (bch2_err_matches(ret, BCH_ERR_operation_blocked)) {
+ if (ret) {
bch2_trans_unlock(trans);
closure_sync(&cl);
- goto retry;
- }
- if (ret)
+ if (bch2_err_matches(ret, BCH_ERR_operation_blocked))
+ goto retry;
return ret;
+ }
sectors = min(sectors, wp->sectors_free);
sectors_allocated = sectors;