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

bcachefs: fix device remove error path

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 19b505a9
...@@ -1306,7 +1306,8 @@ int bch2_dev_remove(struct bch_fs *c, struct bch_dev *ca, int flags) ...@@ -1306,7 +1306,8 @@ int bch2_dev_remove(struct bch_fs *c, struct bch_dev *ca, int flags)
mutex_unlock(&c->state_lock); mutex_unlock(&c->state_lock);
return 0; return 0;
err: err:
if (ca->mi.state == BCH_MEMBER_STATE_RW) if (ca->mi.state == BCH_MEMBER_STATE_RW &&
!percpu_ref_is_zero(&ca->io_ref))
__bch2_dev_read_write(c, ca); __bch2_dev_read_write(c, ca);
mutex_unlock(&c->state_lock); mutex_unlock(&c->state_lock);
return ret; return ret;
......
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