]> sourceware.org Git - lvm2.git/commitdiff
lvconvert: read-only origin cannot be merged
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 9 Feb 2021 23:40:21 +0000 (00:40 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 10 Feb 2021 14:39:03 +0000 (15:39 +0100)
When user sets snapshost origin as read-only,
lvm will not allow simple merge and user needs to
flip permission,

tools/lvconvert.c

index a72126bf49e439a09669f09129f857bc2daceb79..77afaf48786488bfce87af6fb756fff40ea1c8b5 100644 (file)
@@ -2162,15 +2162,21 @@ static int _lvconvert_merge_old_snapshot(struct cmd_context *cmd,
                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));
+                         display_lvname(snap_seg->lv));
                return 0;
        }
 
-       if (lv_is_external_origin(origin_from_cow(lv))) {
+       if (lv_is_external_origin(origin)) {
                log_error("Cannot merge snapshot %s into "
                          "the read-only external origin %s.",
-                         display_lvname(lv),
-                         display_lvname(origin_from_cow(lv)));
+                         display_lvname(lv), display_lvname(origin));
+               return 0;
+       }
+
+       if (!(origin->status & LVM_WRITE)) {
+               log_error("Cannot merge snapshot %s into "
+                         "the read-only origin %s. (Use lvchange -p rw).",
+                         display_lvname(lv), display_lvname(origin));
                return 0;
        }
 
This page took 0.038719 seconds and 5 git commands to generate.