diff --git a/[refs] b/[refs] index 3808708268a4..09d15d7e385a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c9513edb0079f97749c2ac00c887a22c4ba44792 +refs/heads/master: 0c1daee085cff1395d1eba4ad6faff7810a594d8 diff --git a/trunk/fs/btrfs/volumes.c b/trunk/fs/btrfs/volumes.c index 43c4f09e441c..ee197ec28547 100644 --- a/trunk/fs/btrfs/volumes.c +++ b/trunk/fs/btrfs/volumes.c @@ -1291,7 +1291,9 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) } if (device->writeable) { + lock_chunks(root); list_del_init(&device->dev_alloc_list); + unlock_chunks(root); root->fs_info->fs_devices->rw_devices--; } @@ -1345,7 +1347,9 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) } fs_devices->seed = device->fs_devices->seed; device->fs_devices->seed = NULL; + lock_chunks(root); __btrfs_close_devices(device->fs_devices); + unlock_chunks(root); free_fs_devices(device->fs_devices); } @@ -1377,8 +1381,10 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) return ret; error_undo: if (device->writeable) { + lock_chunks(root); list_add(&device->dev_alloc_list, &root->fs_info->fs_devices->alloc_list); + unlock_chunks(root); root->fs_info->fs_devices->rw_devices++; } goto error_brelse;