diff options
| -rw-r--r-- | fs/btrfs/disk-io.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/volumes.c | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 64b289690f9d..4e53a4fc467f 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -1410,6 +1410,7 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits) | |||
| 1410 | struct btrfs_device *device; | 1410 | struct btrfs_device *device; |
| 1411 | struct backing_dev_info *bdi; | 1411 | struct backing_dev_info *bdi; |
| 1412 | 1412 | ||
| 1413 | mutex_lock(&info->fs_devices->device_list_mutex); | ||
| 1413 | list_for_each_entry(device, &info->fs_devices->devices, dev_list) { | 1414 | list_for_each_entry(device, &info->fs_devices->devices, dev_list) { |
| 1414 | if (!device->bdev) | 1415 | if (!device->bdev) |
| 1415 | continue; | 1416 | continue; |
| @@ -1419,6 +1420,7 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits) | |||
| 1419 | break; | 1420 | break; |
| 1420 | } | 1421 | } |
| 1421 | } | 1422 | } |
| 1423 | mutex_unlock(&info->fs_devices->device_list_mutex); | ||
| 1422 | return ret; | 1424 | return ret; |
| 1423 | } | 1425 | } |
| 1424 | 1426 | ||
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 290100fc47be..43c4f09e441c 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
| @@ -481,6 +481,7 @@ static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices) | |||
| 481 | if (--fs_devices->opened > 0) | 481 | if (--fs_devices->opened > 0) |
| 482 | return 0; | 482 | return 0; |
| 483 | 483 | ||
| 484 | mutex_lock(&fs_devices->device_list_mutex); | ||
| 484 | list_for_each_entry(device, &fs_devices->devices, dev_list) { | 485 | list_for_each_entry(device, &fs_devices->devices, dev_list) { |
| 485 | if (device->bdev) { | 486 | if (device->bdev) { |
| 486 | blkdev_put(device->bdev, device->mode); | 487 | blkdev_put(device->bdev, device->mode); |
| @@ -495,6 +496,8 @@ static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices) | |||
| 495 | device->writeable = 0; | 496 | device->writeable = 0; |
| 496 | device->in_fs_metadata = 0; | 497 | device->in_fs_metadata = 0; |
| 497 | } | 498 | } |
| 499 | mutex_unlock(&fs_devices->device_list_mutex); | ||
| 500 | |||
| 498 | WARN_ON(fs_devices->open_devices); | 501 | WARN_ON(fs_devices->open_devices); |
| 499 | WARN_ON(fs_devices->rw_devices); | 502 | WARN_ON(fs_devices->rw_devices); |
| 500 | fs_devices->opened = 0; | 503 | fs_devices->opened = 0; |
| @@ -1415,7 +1418,11 @@ static int btrfs_prepare_sprout(struct btrfs_trans_handle *trans, | |||
| 1415 | INIT_LIST_HEAD(&seed_devices->devices); | 1418 | INIT_LIST_HEAD(&seed_devices->devices); |
| 1416 | INIT_LIST_HEAD(&seed_devices->alloc_list); | 1419 | INIT_LIST_HEAD(&seed_devices->alloc_list); |
| 1417 | mutex_init(&seed_devices->device_list_mutex); | 1420 | mutex_init(&seed_devices->device_list_mutex); |
| 1421 | |||
| 1422 | mutex_lock(&root->fs_info->fs_devices->device_list_mutex); | ||
| 1418 | list_splice_init(&fs_devices->devices, &seed_devices->devices); | 1423 | list_splice_init(&fs_devices->devices, &seed_devices->devices); |
| 1424 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); | ||
| 1425 | |||
| 1419 | list_splice_init(&fs_devices->alloc_list, &seed_devices->alloc_list); | 1426 | list_splice_init(&fs_devices->alloc_list, &seed_devices->alloc_list); |
| 1420 | list_for_each_entry(device, &seed_devices->devices, dev_list) { | 1427 | list_for_each_entry(device, &seed_devices->devices, dev_list) { |
| 1421 | device->fs_devices = seed_devices; | 1428 | device->fs_devices = seed_devices; |
