diff options
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 869864ddcc29..4e7cee27aab5 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -271,13 +271,17 @@ again: | |||
271 | list_for_each(cur, head) { | 271 | list_for_each(cur, head) { |
272 | device = list_entry(cur, struct btrfs_device, dev_list); | 272 | device = list_entry(cur, struct btrfs_device, dev_list); |
273 | if (!device->in_fs_metadata) { | 273 | if (!device->in_fs_metadata) { |
274 | if (device->bdev) { | 274 | struct block_device *bdev; |
275 | close_bdev_excl(device->bdev); | ||
276 | fs_devices->open_devices--; | ||
277 | } | ||
278 | list_del(&device->dev_list); | 275 | list_del(&device->dev_list); |
279 | list_del(&device->dev_alloc_list); | 276 | list_del(&device->dev_alloc_list); |
280 | fs_devices->num_devices--; | 277 | fs_devices->num_devices--; |
278 | if (device->bdev) { | ||
279 | bdev = device->bdev; | ||
280 | fs_devices->open_devices--; | ||
281 | mutex_unlock(&uuid_mutex); | ||
282 | close_bdev_excl(bdev); | ||
283 | mutex_lock(&uuid_mutex); | ||
284 | } | ||
281 | kfree(device->name); | 285 | kfree(device->name); |
282 | kfree(device); | 286 | kfree(device); |
283 | goto again; | 287 | goto again; |