1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Fix rename of active snapshot with virtual origin.

Code must suspend/resume virtual origin too when renaming
snaphsot otherwise in kernel old name remains.
This commit is contained in:
Milan Broz 2009-06-01 15:55:06 +00:00
parent 31f55a07db
commit 771e191e99
3 changed files with 22 additions and 7 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.48 -
===============================
Fix rename of active snapshot with virtual origin.
Fix convert polling to ignore LV with different UUID.
Cache underlying device readahead only before activation calls.
Fix segfault when calculating readahead on missing device in vgreduce.

View File

@ -1765,6 +1765,8 @@ int lv_rename(struct cmd_context *cmd, struct logical_volume *lv,
{
struct volume_group *vg = lv->vg;
struct lv_names lv_names;
DM_LIST_INIT(lvs_changed);
struct lv_list lvl, lvl2;
int r = 0;
/* rename is not allowed on sub LVs */
@ -1799,22 +1801,27 @@ int lv_rename(struct cmd_context *cmd, struct logical_volume *lv,
return 0;
}
lvl.lv = lv;
dm_list_add(&lvs_changed, &lvl.list);
/* rename active virtual origin too */
if (lv_is_cow(lv) && lv_is_virtual_origin(lvl2.lv = origin_from_cow(lv)))
dm_list_add(&lvs_changed, &lvl2.list);
log_verbose("Writing out updated volume group");
if (!vg_write(vg))
return 0;
if (!suspend_lv(cmd, lv)) {
if (!suspend_lvs(cmd, &lvs_changed)) {
vg_revert(vg);
goto_out;
}
if (!vg_commit(vg)) {
resume_lv(cmd, lv);
goto_out;
}
if (!(r = vg_commit(vg)))
stack;
resume_lv(cmd, lv);
r = 1;
resume_lvs(cmd, &lvs_changed);
out:
backup(vg);
return r;

View File

@ -116,3 +116,10 @@ lvcreate -L 32M -n $lv --regionsize 4M -m 1 $vg
check_lv_field_ $vg/$lv regionsize "4.00M"
lvremove -ff $vg
# snapshot with virtual origin works
lvcreate -s --virtualoriginsize 64M -L 32M -n $lv1 $vg
lvrename $vg/$lv1 $vg/$lv2
lvcreate -s --virtualoriginsize 64M -L 32M -n $lv1 $vg
lvchange -a n $vg/$lv1
lvremove $vg/$lv1
lvremove -ff $vg