]> sourceware.org Git - lvm2.git/commitdiff
activation: use revert_lv on tree suspend failure
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 22 Sep 2020 11:35:27 +0000 (13:35 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Tue, 22 Sep 2020 19:02:14 +0000 (21:02 +0200)
When thetable reload fails during suspend() - we were only calling
plain resume() - and this will reload only those devices,
which were left suspend, but will not try to restore
metadata state according to lvm2 reverted metadata.
So if we were reloading device tree - we have restored
only top-level LV and rest of reverted device manipulation
were left alone and possibly mismatched what is in committed
metadata.

FIXME: There are several cases were such revert will likely not work
properly anyway as some operation are currenly handled in single commit,
while they need multiple commits, but it's step towards better correctness.
At least we catch there errors now earlier.

WHATS_NEW
lib/activate/activate.c
lib/metadata/lv_manip.c

index 0f6412fc504f4829dec04d2921cf39c5471ee97d..4be9b8badfd29819bdc1ca14edc7bc920f3a9794 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.03.11 - 
 ==================================
+  Use revert_lv() on reload error path after vg_revert().
   Configure --with-integrity enabled.
   Restore lost signal blocking while VG lock is held.
   Improve estimation of needed extents when creating thin-pool.
index 0c6bd1a9a34d33def000b25f109882273cee55bc..a9a01a8bcd97297e29fc7ea3a11a80d7c7a552b7 100644 (file)
@@ -2322,6 +2322,9 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
                              lv_is_thin_volume(lv) ? " thin only" : " without snapshots") : "",
                             laopts->revert ? " (reverting)" : "");
 
+       if (laopts->revert)
+               goto needs_resume;
+
        if (!lv_info(cmd, lv, laopts->origin_only, &info, 0, 0))
                goto_out;
 
index 063ff3e031f367fc10c3bdd825ba9250b313c4d5..6ac6a602b86102783953ed78cf2f15196dc809d8 100644 (file)
@@ -6858,6 +6858,10 @@ static int _lv_update_and_reload(struct logical_volume *lv, int origin_only)
                log_error("Failed to suspend logical volume %s.",
                          display_lvname(lock_lv));
                vg_revert(vg);
+               if (!revert_lv(vg->cmd, lock_lv))
+                       log_error("Failed to revert logical volume %s.",
+                                 display_lvname(lock_lv));
+               return 0;
        } else if (!(r = vg_commit(vg)))
                stack; /* !vg_commit() has implict vg_revert() */
        else
This page took 0.055821 seconds and 5 git commands to generate.