]> sourceware.org Git - lvm2.git/commitdiff
lv_manip: avoid removing LV when converting
authorZdenek Kabelac <zkabelac@redhat.com>
Wed, 17 Feb 2021 10:09:41 +0000 (11:09 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 17 Feb 2021 10:21:35 +0000 (11:21 +0100)
In some cases we use 'creation' also during conversion.
Here it can be actually unwanted side effect we may remove
not just newly created layers - but also original converted LV.

So until we make clear how to properly revert from some errors
in middle of conversion, disable removal for any 'lvconvert' commands.

lib/metadata/lv_manip.c

index 32bdc7990374dce12b25014e1e470d2d30fe9abb..5784e407d3084bb62269990448e6418882a8845c 100644 (file)
@@ -8809,7 +8809,9 @@ revert_new_lv:
        lockd_free_lv(vg->cmd, vg, lv->name, &lv->lvid.id[1], lv->lock_args);
 
        /* FIXME Better to revert to backup of metadata? */
-       if (!lv_remove(lv) || !vg_write(vg) || !vg_commit(vg))
+       /* Do not remove anything for create during conversion operation */
+       if (!strncmp(cmd->name, "lvconvert", 9) ||
+           !lv_remove(lv) || !vg_write(vg) || !vg_commit(vg))
                log_error("Manual intervention may be required to remove "
                          "abandoned LV(s) before retrying.");
        else
This page took 0.0435 seconds and 5 git commands to generate.