summaryrefslogtreecommitdiff
path: root/drivers/md/dm-ioctl.c
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2009-12-10 23:52:24 +0000
committerAlasdair G Kergon <agk@redhat.com>2009-12-10 23:52:24 +0000
commit042d2a9bcd80fe12d4b0871706aa9dd2231e8238 (patch)
tree69a7b6675e2cd020807729de50cd99747f6470f4 /drivers/md/dm-ioctl.c
parenta794015597a2d9b437470c7692aac77e5fc08cd2 (diff)
downloadlinux-3.10-042d2a9bcd80fe12d4b0871706aa9dd2231e8238.tar.gz
linux-3.10-042d2a9bcd80fe12d4b0871706aa9dd2231e8238.tar.bz2
linux-3.10-042d2a9bcd80fe12d4b0871706aa9dd2231e8238.zip
dm: keep old table until after resume succeeded
When swapping a new table into place, retain the old table until its replacement is in place. An old check for an empty table is removed because this is enforced in populate_table(). __unbind() becomes redundant when followed by __bind(). Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-ioctl.c')
-rw-r--r--drivers/md/dm-ioctl.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index a3d20265ffc..63fd4de25bd 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -855,7 +855,7 @@ static int do_resume(struct dm_ioctl *param)
unsigned suspend_flags = DM_SUSPEND_LOCKFS_FLAG;
struct hash_cell *hc;
struct mapped_device *md;
- struct dm_table *new_map;
+ struct dm_table *new_map, *old_map = NULL;
down_write(&_hash_lock);
@@ -884,11 +884,11 @@ static int do_resume(struct dm_ioctl *param)
if (!dm_suspended(md))
dm_suspend(md, suspend_flags);
- r = dm_swap_table(md, new_map);
- if (r) {
+ old_map = dm_swap_table(md, new_map);
+ if (IS_ERR(old_map)) {
dm_table_destroy(new_map);
dm_put(md);
- return r;
+ return PTR_ERR(old_map);
}
if (dm_table_get_mode(new_map) & FMODE_WRITE)
@@ -900,6 +900,8 @@ static int do_resume(struct dm_ioctl *param)
if (dm_suspended(md))
r = dm_resume(md);
+ if (old_map)
+ dm_table_destroy(old_map);
if (!r) {
dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr);