master - snapshot: deactivate virtual snapshot first
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1146691afc740257d03c7ca53bfa07918a4bc715 Commit: 1146691afc740257d03c7ca53bfa07918a4bc715 Parent: ac961087b0fe9846f95bedee7687d9ca840b217d Author: Zdenek Kabelac <[email protected]> AuthorDate: Fri Oct 11 23:53:28 2013 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon Oct 14 00:25:15 2013 +0200
snapshot: deactivate virtual snapshot first
Since the virtual snapshot has no reason to stay alive once we detach related snapshot - deactivate whole thing in front of snapshot removal - otherwice the code would get tricky for support in cluster.
The correct full solution would require to have transactions for libdm operations.
Also enable to the check for snapshot being opened prior the origin deactivation, otherwise we could easily end with the origin being deactivate, but snapshot still kept active, desynchronizing locking state in cluster.
--- WHATS_NEW | 1 + lib/activate/activate.c | 2 +- lib/metadata/snapshot_manip.c | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.104 =================================== + Add workaround for deactivation problem of opened virtual snapshot. Disable unsupported merge for virtual snapshot. Move code to remove virtual snapshot from tools to lib for lvm2app. Fix possible race during daemon worker thread creation (lvmetad).
lib/activate/activate.c +1 -1
@@ -1929,7 +1929,7 @@ int lv_deactivate(struct cmd_context *cmd, const char *lvid_s, struct logical_vo goto out; } -if (lv_is_visible (lv)) { +if (lv_is_visible (lv) ||lv_is_virtual_origin (lv)) {if (!lv_check_not_in_use (cmd, lv, &info)) goto_out;
lib/metadata/snapshot_manip.c +10 -0
@@ -227,6 +227,16 @@ int vg_remove_snapshot(struct logical_volume *cow)struct logical_volume *origin =origin_from_cow (cow);int is_origin_active =lv_is_active (origin); +if (is_origin_active && +lv_is_virtual_origin (origin)) { +if (!deactivate_lv (origin->vg->cmd, origin)) { +log_error ("Failed to deactivate logical volume \"%s\"" , + origin->name); +return 0 ; + } + is_origin_active =0 ; + } +dm_list_del (&cow->snapshot->origin_list); origin->origin_count--;