diff options
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 43c4f09e441c..ee197ec28547 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1291,7 +1291,9 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1291 | } | 1291 | } |
1292 | 1292 | ||
1293 | if (device->writeable) { | 1293 | if (device->writeable) { |
1294 | lock_chunks(root); | ||
1294 | list_del_init(&device->dev_alloc_list); | 1295 | list_del_init(&device->dev_alloc_list); |
1296 | unlock_chunks(root); | ||
1295 | root->fs_info->fs_devices->rw_devices--; | 1297 | root->fs_info->fs_devices->rw_devices--; |
1296 | } | 1298 | } |
1297 | 1299 | ||
@@ -1345,7 +1347,9 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1345 | } | 1347 | } |
1346 | fs_devices->seed = device->fs_devices->seed; | 1348 | fs_devices->seed = device->fs_devices->seed; |
1347 | device->fs_devices->seed = NULL; | 1349 | device->fs_devices->seed = NULL; |
1350 | lock_chunks(root); | ||
1348 | __btrfs_close_devices(device->fs_devices); | 1351 | __btrfs_close_devices(device->fs_devices); |
1352 | unlock_chunks(root); | ||
1349 | free_fs_devices(device->fs_devices); | 1353 | free_fs_devices(device->fs_devices); |
1350 | } | 1354 | } |
1351 | 1355 | ||
@@ -1377,8 +1381,10 @@ out: | |||
1377 | return ret; | 1381 | return ret; |
1378 | error_undo: | 1382 | error_undo: |
1379 | if (device->writeable) { | 1383 | if (device->writeable) { |
1384 | lock_chunks(root); | ||
1380 | list_add(&device->dev_alloc_list, | 1385 | list_add(&device->dev_alloc_list, |
1381 | &root->fs_info->fs_devices->alloc_list); | 1386 | &root->fs_info->fs_devices->alloc_list); |
1387 | unlock_chunks(root); | ||
1382 | root->fs_info->fs_devices->rw_devices++; | 1388 | root->fs_info->fs_devices->rw_devices++; |
1383 | } | 1389 | } |
1384 | goto error_brelse; | 1390 | goto error_brelse; |