bcachefs: fix device remove error path

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet
2023-10-22 17:08:13 -04:00
committed by Kent Overstreet
parent 19b505a934
commit d3bb629d04
+2 -1
View File
@@ -1306,7 +1306,8 @@ int bch2_dev_remove(struct bch_fs *c, struct bch_dev *ca, int flags)
mutex_unlock(&c->state_lock);
return 0;
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);
mutex_unlock(&c->state_lock);
return ret;