master - snapshot: fix merging
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f6ded62291682e40c7976d27e48915d9d1538940 Commit: f6ded62291682e40c7976d27e48915d9d1538940 Parent: 6ca81a091c5a79bee0ec46c21aea643907ab2ca7 Author: Zdenek Kabelac <[email protected]> AuthorDate: Mon Jul 22 16:20:36 2013 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon Jul 22 16:26:00 2013 +0200
snapshot: fix merging
When the merging of snapshot is finished, we need to clean dm table intries for snapshot and -cow device. So for merging snapshot we have to activate_lv plain 'cow' LV and let the table resolver to its work - shortly deactivation_lv() request will follow - in cluster this needs LV lock to be held by clvmd.
Also update a test - add small wait - if lvremove is not 'fast enough' and merging process has not been stopped and $lv1 removed in background. Ortherwise the following lvcreate occasionally finds name $lv1 still in use.
(in release fix)
--- lib/metadata/snapshot_manip.c | 9 +++++++++ test/shell/snapshot-merge.sh | 6 ++++++ 2 files changed, 15 insertions(+), 0 deletions(-)
lib/metadata/snapshot_manip.c +9 -0
@@ -296,6 +296,15 @@ int vg_remove_snapshot(struct logical_volume *cow)log_error ("Failed to resume %s." , origin->name);return 0 ; } + +/* +* For merged snapshot we activate cow so it can clean +* left table entries and deactivate_lv() follows shortly. +*/ +if (merging_snapshot && !activate_lv (cow->vg->cmd, cow)) { +log_error ("Failed to activate %s." , cow->name); +return 0 ; + } }return 1 ;
test/shell/snapshot-merge.sh +6 -0
@@ -78,6 +78,12 @@ dm_table $vg-$lv1 | grep " snapshot-merge " || dm_table $vg-$lv1 | grep " linear # may test stopping an active merge lvremove -f $vg/$lv1 +# wait a while if the merge and remove is still not finished +# since it may still keep $lv1 in vg being present +for i in 1 2 3 4 ; do + lvs $vg/$lv1 2>/dev/null || break; + sleep .2 +done # "onactivate merge" test # -- deactivate/remove after disallowed merge attempt, tests