aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index db79fb7e7e91..92e586bc8004 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1681,16 +1681,17 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
1681 filemap_write_and_wait(bdev->bd_inode->i_mapping); 1681 filemap_write_and_wait(bdev->bd_inode->i_mapping);
1682 1682
1683 devices = &root->fs_info->fs_devices->devices; 1683 devices = &root->fs_info->fs_devices->devices;
1684 /* 1684
1685 * we have the volume lock, so we don't need the extra 1685 mutex_lock(&root->fs_info->fs_devices->device_list_mutex);
1686 * device list mutex while reading the list here.
1687 */
1688 list_for_each_entry(device, devices, dev_list) { 1686 list_for_each_entry(device, devices, dev_list) {
1689 if (device->bdev == bdev) { 1687 if (device->bdev == bdev) {
1690 ret = -EEXIST; 1688 ret = -EEXIST;
1689 mutex_unlock(
1690 &root->fs_info->fs_devices->device_list_mutex);
1691 goto error; 1691 goto error;
1692 } 1692 }
1693 } 1693 }
1694 mutex_unlock(&root->fs_info->fs_devices->device_list_mutex);
1694 1695
1695 device = kzalloc(sizeof(*device), GFP_NOFS); 1696 device = kzalloc(sizeof(*device), GFP_NOFS);
1696 if (!device) { 1697 if (!device) {