From 249e7765466589fc33d1c40505e0d81c9260cdb8 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Tue, 15 Feb 2011 18:14:25 +0000 Subject: [PATCH] --- yaml --- r: 233682 b: refs/heads/master c: 9b3517e9136824346227b7b04f8f7ea1f3a726cc h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/btrfs/volumes.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 2d854d2c66b5..f1f7b225cc78 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ca9b688c1c9a21635cfc8af8b68565b154185196 +refs/heads/master: 9b3517e9136824346227b7b04f8f7ea1f3a726cc diff --git a/trunk/fs/btrfs/volumes.c b/trunk/fs/btrfs/volumes.c index dadaaa8005c8..f31c33119bb6 100644 --- a/trunk/fs/btrfs/volumes.c +++ b/trunk/fs/btrfs/volumes.c @@ -1337,11 +1337,11 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) ret = btrfs_shrink_device(device, 0); if (ret) - goto error_brelse; + goto error_undo; ret = btrfs_rm_dev_item(root->fs_info->chunk_root, device); if (ret) - goto error_brelse; + goto error_undo; device->in_fs_metadata = 0; @@ -1415,6 +1415,13 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) mutex_unlock(&root->fs_info->volume_mutex); mutex_unlock(&uuid_mutex); return ret; +error_undo: + if (device->writeable) { + list_add(&device->dev_alloc_list, + &root->fs_info->fs_devices->alloc_list); + root->fs_info->fs_devices->rw_devices++; + } + goto error_brelse; } /*