diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 57a7f331eb3ebe3c5484fa7e0e1c2dbc90f1b5d5..77d7fbc0fa47928f350a7fa21aefe7d1a8fd5f86 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1649,8 +1649,8 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) if (device->writeable) { lock_chunks(root); list_del_init(&device->dev_alloc_list); + device->fs_devices->rw_devices--; unlock_chunks(root); - root->fs_info->fs_devices->rw_devices--; clear_super = true; } @@ -1795,8 +1795,8 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) lock_chunks(root); list_add(&device->dev_alloc_list, &root->fs_info->fs_devices->alloc_list); + device->fs_devices->rw_devices++; unlock_chunks(root); - root->fs_info->fs_devices->rw_devices++; } goto error_brelse; }