summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-08-12 22:52:33 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:10:10 +0200
commitdf5a915a15a7343170f6ce707d807daa9efc245c (patch)
tree62c6bcb473cb503725751a2ad2351c441ad17b45 /fs/bcachefs/io.c
parentbcachefs: Add a comment for should_drop_open_bucket() (diff)
downloadlinux-df5a915a15a7343170f6ce707d807daa9efc245c.tar.xz
linux-df5a915a15a7343170f6ce707d807daa9efc245c.zip
bcachefs: Fix lifetime in bch2_write_done(), add assertion
We're hunting for an open_bucket leak, add an assertion to help track it down: also, we can't use the bch_fs after dropping our write ref to it. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to '')
-rw-r--r--fs/bcachefs/io.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index f42d9da2e16e..499585d7cc5d 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -710,13 +710,15 @@ static void bch2_write_done(struct closure *cl)
struct bch_write_op *op = container_of(cl, struct bch_write_op, cl);
struct bch_fs *c = op->c;
+ EBUG_ON(op->open_buckets.nr);
+
+ bch2_time_stats_update(&c->times[BCH_TIME_data_write], op->start_time);
bch2_disk_reservation_put(c, &op->res);
+
if (!(op->flags & BCH_WRITE_MOVE))
bch2_write_ref_put(c, BCH_WRITE_REF_write);
bch2_keylist_free(&op->insert_keys, op->inline_keys);
- bch2_time_stats_update(&c->times[BCH_TIME_data_write], op->start_time);
-
EBUG_ON(cl->parent);
closure_debug_destroy(cl);
if (op->end_io)