diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2012-11-14 09:35:30 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2012-12-12 17:15:28 -0500 |
commit | d25628bdd66aedd6e07729d8dc6c8ee846d66d72 (patch) | |
tree | a2d8e42e7353380ab6527739468ff1dd5b8e1144 | |
parent | b53d3f5db2b79637acadc06a330db6c2c60863f5 (diff) |
Btrfs: protect devices list with its mutex
Since we've kill the bigger one volume_mutex, we need to add devices
list mutex back.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
-rw-r--r-- | fs/btrfs/volumes.c | 9 |
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) { |