summaryrefslogtreecommitdiff
path: root/fs/bcachefs/io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-06-29 18:22:06 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:42 -0400
commit042a1f268e82678ea202390b8a69457aafacd4a0 (patch)
tree710c979e4565174d0b1ec11cf3732456629481d9 /fs/bcachefs/io.c
parent64f2a8803ec8d3702a4b5225726f9c1dc685f43a (diff)
downloadlwn-042a1f268e82678ea202390b8a69457aafacd4a0.tar.gz
lwn-042a1f268e82678ea202390b8a69457aafacd4a0.zip
bcachefs: Refactor dio write code to reinit bch_write_op
This fixes a bug where the BCH_WRITE_SKIP_CLOSURE_PUT was set incorrectly, causing the completion to be delivered multiple times. oops. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/io.c')
-rw-r--r--fs/bcachefs/io.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index 39a23c6570eb..ca27e7dff5e0 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -509,8 +509,7 @@ static void bch2_write_done(struct closure *cl)
if (!op->error && (op->flags & BCH_WRITE_FLUSH))
op->error = bch2_journal_error(&c->journal);
- if (!(op->flags & BCH_WRITE_NOPUT_RESERVATION))
- bch2_disk_reservation_put(c, &op->res);
+ bch2_disk_reservation_put(c, &op->res);
percpu_ref_put(&c->writes);
bch2_keylist_free(&op->insert_keys, op->inline_keys);
@@ -1273,8 +1272,7 @@ void bch2_write(struct closure *cl)
continue_at_nobarrier(cl, __bch2_write, NULL);
return;
err:
- if (!(op->flags & BCH_WRITE_NOPUT_RESERVATION))
- bch2_disk_reservation_put(c, &op->res);
+ bch2_disk_reservation_put(c, &op->res);
if (op->end_io) {
EBUG_ON(cl->parent);