summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-11-13 23:03:42 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2022-11-14 01:58:29 -0500
commit78a355b29aa7b943c1b8805138fb0b62c15fc89b (patch)
treea203a6c328a491c31c7cd0f80ce1917834b69328
parent2e1c1253c49371d01e9c5422ab435cc1f4f7437c (diff)
XXX space leakbcachefs-nocow
-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 47e614527b61..684c2e15bd2c 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -356,10 +356,12 @@ int bch2_extent_fallocate(struct btree_trans *trans,
{
struct bch_fs *c = trans->c;
struct closure cl;
+ struct open_buckets open_buckets;
struct bkey_i *new;
int ret;
closure_init_stack(&cl);
+ open_buckets.nr = 0;
if (!opts.nocow) {
struct bkey_i_reservation *reservation =
@@ -416,6 +418,7 @@ int bch2_extent_fallocate(struct btree_trans *trans,
bch2_key_resize(&e->k, sectors);
+ bch2_open_bucket_get(c, wp, &open_buckets);
bch2_alloc_sectors_append_ptrs(c, wp, &e->k_i, sectors, false);
bch2_alloc_sectors_done(c, wp);
@@ -432,6 +435,10 @@ int bch2_extent_fallocate(struct btree_trans *trans,
closure_sync(&cl);
}
+ /* XXX: on transaction restart, we leak space */
+
+ bch2_open_buckets_put(c, &open_buckets);
+
return ret;
}