Now that the preparation work is done, remove the temporary BUG_ON() in
close_fs_devices() and return an error instead.
Signed-off-by: Johannes Thumshirn <jthumshirn@xxxxxxx>
---
fs/btrfs/volumes.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index be1fd935edf7..844333b96075 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1128,7 +1128,12 @@ static int close_fs_devices(struct btrfs_fs_devices *fs_devices)
mutex_lock(&fs_devices->device_list_mutex);
list_for_each_entry_safe(device, tmp, &fs_devices->devices, dev_list) {
ret = btrfs_close_one_device(device);
- BUG_ON(ret); /* -ENOMEM */
+ if (ret) {
+ mutex_unlock(&fs_devices->device_list_mutex);
+ return ret;
+ }
+ fs_devices->opened--;
+ fs_devices->seeding--;
}
mutex_unlock(&fs_devices->device_list_mutex);
--
2.16.4