]> sourceware.org Git - lvm2.git/commitdiff
lv_manip: add synchronizations
authorZdenek Kabelac <zkabelac@redhat.com>
Mon, 26 Aug 2019 11:28:17 +0000 (13:28 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Mon, 26 Aug 2019 13:32:19 +0000 (15:32 +0200)
New udev in rawhide seems to be 'dropping' udev rule operations for devices
that are no longer existing - while this is 'probably' a bug - it's
revealing moments in lvm2 that likely should not run in a single
transaction and we should wait for a cookie before submitting more work.

TODO: it seem more 'error' paths should always include synchronization
before starting deactivating 'just activated' devices.
We should probably figure out some 'automatic' solution for this instead
of placing sync_local_dev_name() all over the place...

lib/metadata/lv_manip.c
lib/metadata/snapshot_manip.c
lib/metadata/thin_manip.c
tools/lvconvert.c

index af3a16fe2d214bc36e190e6583dd3f0ffede3569..6451368772dcaa5e8086fc24855e394c8be6f207 100644 (file)
@@ -5830,9 +5830,17 @@ out:
 
        ret = 1;
 bad:
-       if (activated && !deactivate_lv(cmd, lock_lv)) {
-               log_error("Problem deactivating %s.", display_lvname(lock_lv));
-               ret = 0;
+       if (activated) {
+               if (!sync_local_dev_names(lock_lv->vg->cmd)) {
+                       log_error("Failed to sync local devices before deactivating LV %s.",
+                                 display_lvname(lock_lv));
+                       return 0;
+               }
+
+               if (!deactivate_lv(cmd, lock_lv)) {
+                       log_error("Problem deactivating %s.", display_lvname(lock_lv));
+                       ret = 0;
+               }
        }
 
        return ret;
index 65d8dbd13f9533898a4ed6b71f13bff0d93bccab..d105942c0f0f77582a4b92c5062c4f3e3a57752d 100644 (file)
@@ -292,6 +292,11 @@ int vg_remove_snapshot(struct logical_volume *cow)
 
        if (is_origin_active &&
            lv_is_virtual_origin(origin)) {
+               if (!sync_local_dev_names(origin->vg->cmd)) {
+                       log_error("Failed to sync local devices before deactivating origin LV %s.",
+                                 display_lvname(origin));
+                       return 0;
+               }
                if (!deactivate_lv(origin->vg->cmd, origin)) {
                        log_error("Failed to deactivate logical volume \"%s\"",
                                  origin->name);
index b9c01ee21590d26c9fdddb73e8d64e69662bd0ad..f94797620f10fdf4d0c8e979976fb1e99e6bd97b 100644 (file)
@@ -529,6 +529,12 @@ int update_pool_lv(struct logical_volume *lv, int activate)
                        }
                }
 
+               if (!sync_local_dev_names(lv->vg->cmd)) {
+                       log_error("Failed to sync local devices LV %s.",
+                                 display_lvname(lv));
+                       return 0;
+               }
+
                if (activate &&
                    !deactivate_lv(lv->vg->cmd, lv)) {
                        log_error("Failed to deactivate %s.", display_lvname(lv));
index ebc22433f8e76ac14f746126ace5997629741411..31f9296769ac275542b064dfb77f13b2d09c105b 100644 (file)
@@ -2513,6 +2513,12 @@ static int _lvconvert_cache_repair(struct cmd_context *cmd,
        /* TODO: any active validation of cache-pool metadata? */
 
 deactivate_mlv:
+       if (!sync_local_dev_names(cmd)) {
+               log_error("Failed to sync local devices before deactivating LV %s.",
+                         display_lvname(mlv));
+               return 0;
+       }
+
        if (!deactivate_lv(cmd, mlv)) {
                log_error("Cannot deactivate pool metadata volume %s.",
                          display_lvname(mlv));
@@ -2520,6 +2526,12 @@ deactivate_mlv:
        }
 
 deactivate_pmslv:
+       if (!sync_local_dev_names(cmd)) {
+               log_error("Failed to sync local devices before deactivating LV %s.",
+                         display_lvname(pmslv));
+               return 0;
+       }
+
        if (!deactivate_lv(cmd, pmslv)) {
                log_error("Cannot deactivate pool metadata spare volume %s.",
                          display_lvname(pmslv));
This page took 0.045888 seconds and 5 git commands to generate.