diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-02-22 18:35:51 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:54 -0400 |
commit | e3877382fb9d0a8ae43c7e012742622bbd6e6d17 (patch) | |
tree | 01fb599402c529e1d6b833d682d34a40931779a4 | |
parent | 64784ade4fd75cdd47d7ddfbfcbed3506fe10523 (diff) | |
download | lwn-e3877382fb9d0a8ae43c7e012742622bbd6e6d17.tar.gz lwn-e3877382fb9d0a8ae43c7e012742622bbd6e6d17.zip |
bcachefs: Fix erasure coding shutdown path
It's possible when shutting down to for a stripe head to have a new
stripe that doesn't yet have any blocks allocated - we just need to free
it.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/ec.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c index 4b054f7c4d4e..123ca0b0b43f 100644 --- a/fs/bcachefs/ec.c +++ b/fs/bcachefs/ec.c @@ -1764,6 +1764,7 @@ void bch2_new_stripes_to_text(struct printbuf *out, struct bch_fs *c) void bch2_fs_ec_exit(struct bch_fs *c) { struct ec_stripe_head *h; + unsigned i; while (1) { mutex_lock(&c->ec_stripe_head_lock); @@ -1775,7 +1776,12 @@ void bch2_fs_ec_exit(struct bch_fs *c) if (!h) break; - BUG_ON(h->s); + if (h->s) { + for (i = 0; i < h->s->new_stripe.key.v.nr_blocks; i++) + BUG_ON(h->s->blocks[i]); + + kfree(h->s); + } kfree(h); } |