diff options
author | Alasdair G Kergon <agk@redhat.com> | 2009-12-10 18:52:24 -0500 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2009-12-10 18:52:24 -0500 |
commit | 042d2a9bcd80fe12d4b0871706aa9dd2231e8238 (patch) | |
tree | 69a7b6675e2cd020807729de50cd99747f6470f4 /drivers/md/dm-ioctl.c | |
parent | a794015597a2d9b437470c7692aac77e5fc08cd2 (diff) |
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.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index a3d20265ffc1..63fd4de25bda 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) | |||
855 | unsigned suspend_flags = DM_SUSPEND_LOCKFS_FLAG; | 855 | unsigned suspend_flags = DM_SUSPEND_LOCKFS_FLAG; |
856 | struct hash_cell *hc; | 856 | struct hash_cell *hc; |
857 | struct mapped_device *md; | 857 | struct mapped_device *md; |
858 | struct dm_table *new_map; | 858 | struct dm_table *new_map, *old_map = NULL; |
859 | 859 | ||
860 | down_write(&_hash_lock); | 860 | down_write(&_hash_lock); |
861 | 861 | ||
@@ -884,11 +884,11 @@ static int do_resume(struct dm_ioctl *param) | |||
884 | if (!dm_suspended(md)) | 884 | if (!dm_suspended(md)) |
885 | dm_suspend(md, suspend_flags); | 885 | dm_suspend(md, suspend_flags); |
886 | 886 | ||
887 | r = dm_swap_table(md, new_map); | 887 | old_map = dm_swap_table(md, new_map); |
888 | if (r) { | 888 | if (IS_ERR(old_map)) { |
889 | dm_table_destroy(new_map); | 889 | dm_table_destroy(new_map); |
890 | dm_put(md); | 890 | dm_put(md); |
891 | return r; | 891 | return PTR_ERR(old_map); |
892 | } | 892 | } |
893 | 893 | ||
894 | if (dm_table_get_mode(new_map) & FMODE_WRITE) | 894 | if (dm_table_get_mode(new_map) & FMODE_WRITE) |
@@ -900,6 +900,8 @@ static int do_resume(struct dm_ioctl *param) | |||
900 | if (dm_suspended(md)) | 900 | if (dm_suspended(md)) |
901 | r = dm_resume(md); | 901 | r = dm_resume(md); |
902 | 902 | ||
903 | if (old_map) | ||
904 | dm_table_destroy(old_map); | ||
903 | 905 | ||
904 | if (!r) { | 906 | if (!r) { |
905 | dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr); | 907 | dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr); |