1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

snapshot: prevent repeated merging

Check and prevent starting another snapshot merge before
exiting merging is finished.

TODO: we can possibly implement smarter logic to drop existing
merging and start a new one.
This commit is contained in:
Zdenek Kabelac 2017-11-04 22:15:59 +01:00
parent 1b6dfd4802
commit 014122256b
2 changed files with 10 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.177 -
====================================
Prevent start of new merge of snapshot if origin is already being merged.
Version 2.02.176 - 3rd November 2017
====================================

View File

@ -2008,6 +2008,15 @@ static int _lvconvert_merge_old_snapshot(struct cmd_context *cmd,
struct lvinfo info;
dm_percent_t snap_percent;
/* Check if merge is possible */
if (lv_is_merging_origin(origin)) {
log_error("Cannot merge snapshot %s into the origin %s "
"with merging snapshot %s.",
display_lvname(lv), display_lvname(origin),
display_lvname(find_snapshot(origin)->lv));
return 0;
}
if (lv_is_external_origin(origin_from_cow(lv))) {
log_error("Cannot merge snapshot \"%s\" into "
"the read-only external origin \"%s\".",