Commit f516c872 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix stripe_idx_to_delete()

There was a null ptr deref when there wasn't a stripes heap allocated
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 97fd13ad
...@@ -575,7 +575,8 @@ static ssize_t stripe_idx_to_delete(struct bch_fs *c) ...@@ -575,7 +575,8 @@ static ssize_t stripe_idx_to_delete(struct bch_fs *c)
{ {
ec_stripes_heap *h = &c->ec_stripes_heap; ec_stripes_heap *h = &c->ec_stripes_heap;
return h->data[0].blocks_nonempty == 0 ? h->data[0].idx : -1; return h->used && h->data[0].blocks_nonempty == 0
? h->data[0].idx : -1;
} }
static inline int ec_stripes_heap_cmp(ec_stripes_heap *h, static inline int ec_stripes_heap_cmp(ec_stripes_heap *h,
......
...@@ -277,6 +277,7 @@ void bch2_fs_read_only(struct bch_fs *c) ...@@ -277,6 +277,7 @@ void bch2_fs_read_only(struct bch_fs *c)
*/ */
percpu_ref_kill(&c->writes); percpu_ref_kill(&c->writes);
cancel_work_sync(&c->ec_stripe_delete_work);
cancel_delayed_work(&c->pd_controllers_update); cancel_delayed_work(&c->pd_controllers_update);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment