mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
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)
This commit is contained in:
parent
6ca81a091c
commit
f6ded62291
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user