mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +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:
parent
ac961087b0
commit
1146691afc
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.104
|
Version 2.02.104
|
||||||
===================================
|
===================================
|
||||||
|
Add workaround for deactivation problem of opened virtual snapshot.
|
||||||
Disable unsupported merge for virtual snapshot.
|
Disable unsupported merge for virtual snapshot.
|
||||||
Move code to remove virtual snapshot from tools to lib for lvm2app.
|
Move code to remove virtual snapshot from tools to lib for lvm2app.
|
||||||
Fix possible race during daemon worker thread creation (lvmetad).
|
Fix possible race during daemon worker thread creation (lvmetad).
|
||||||
|
@ -1929,7 +1929,7 @@ int lv_deactivate(struct cmd_context *cmd, const char *lvid_s, struct logical_vo
|
|||||||
goto out;
|
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))
|
if (!lv_check_not_in_use(cmd, lv, &info))
|
||||||
goto_out;
|
goto_out;
|
||||||
|
|
||||||
|
@ -227,6 +227,16 @@ int vg_remove_snapshot(struct logical_volume *cow)
|
|||||||
struct logical_volume *origin = origin_from_cow(cow);
|
struct logical_volume *origin = origin_from_cow(cow);
|
||||||
int is_origin_active = lv_is_active(origin);
|
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);
|
dm_list_del(&cow->snapshot->origin_list);
|
||||||
origin->origin_count--;
|
origin->origin_count--;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user