diff options
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 34068b887f14..3f1c2c200691 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1620,7 +1620,11 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1620 | /* | 1620 | /* |
1621 | * the device list mutex makes sure that we don't change | 1621 | * the device list mutex makes sure that we don't change |
1622 | * the device list while someone else is writing out all | 1622 | * the device list while someone else is writing out all |
1623 | * the device supers. | 1623 | * the device supers. Whoever is writing all supers, should |
1624 | * lock the device list mutex before getting the number of | ||
1625 | * devices in the super block (super_copy). Conversely, | ||
1626 | * whoever updates the number of devices in the super block | ||
1627 | * (super_copy) should hold the device list mutex. | ||
1624 | */ | 1628 | */ |
1625 | 1629 | ||
1626 | cur_devices = device->fs_devices; | 1630 | cur_devices = device->fs_devices; |
@@ -1644,10 +1648,10 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1644 | device->fs_devices->open_devices--; | 1648 | device->fs_devices->open_devices--; |
1645 | 1649 | ||
1646 | call_rcu(&device->rcu, free_device); | 1650 | call_rcu(&device->rcu, free_device); |
1647 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); | ||
1648 | 1651 | ||
1649 | num_devices = btrfs_super_num_devices(root->fs_info->super_copy) - 1; | 1652 | num_devices = btrfs_super_num_devices(root->fs_info->super_copy) - 1; |
1650 | btrfs_set_super_num_devices(root->fs_info->super_copy, num_devices); | 1653 | btrfs_set_super_num_devices(root->fs_info->super_copy, num_devices); |
1654 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); | ||
1651 | 1655 | ||
1652 | if (cur_devices->open_devices == 0) { | 1656 | if (cur_devices->open_devices == 0) { |
1653 | struct btrfs_fs_devices *fs_devices; | 1657 | struct btrfs_fs_devices *fs_devices; |