1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

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.
This commit is contained in:
Zdenek Kabelac 2013-10-11 23:53:28 +02:00
parent ac961087b0
commit 1146691afc
3 changed files with 12 additions and 1 deletions

View File

@ -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).

View File

@ -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;

View File

@ -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--;