diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2018-12-18 08:41:58 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2018-12-27 11:38:38 -0500 |
commit | 3692e7bc0f7923846efe8d29e479901981e3c405 (patch) | |
tree | 1a203b5125b663f0d8351070d96a84b88085d74c | |
parent | c5a6835a6098453582aadde2b4b04d98440c51f2 (diff) |
bcachefs: fix device remove error path
-rw-r--r-- | fs/bcachefs/super.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index 0212832a7e8a..82a0bf0729b9 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -1344,7 +1344,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; |