]> sourceware.org Git - lvm2.git/commitdiff
device_mapper: deactive new nodes when load fails
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 29 Jun 2018 15:25:38 +0000 (17:25 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Mon, 2 Jul 2018 08:25:35 +0000 (10:25 +0200)
When node loading fails, there is not much the caller can do,
since there is 'unknown' set of devices preloaded.

Only suspend during preload knows future precommitted 'metadata',
so it's non-trivial to drop 'preloaded' entries with any later call.

However dm tree tracks newly loaded entries - so in this case it
may simplify the recovery path by dropping preloaded entries so
they are not leaked in the DM table.

device_mapper/libdm-deptree.c

index bb552b679500c052a575ceaa56dc1584af965fd3..4609796e2b10afdb75a2bff1494ab54389b79adc 100644 (file)
@@ -2877,8 +2877,14 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
                         * insufficient to remove those - only the node
                         * encountering the table load failure is removed.
                         */
-                       if (node_created && !_remove_node(child))
-                               return_0;
+                       if (node_created) {
+                               if (!_remove_node(child))
+                                       return_0;
+                               if (!dm_udev_wait(dm_tree_get_cookie(dnode)))
+                                       stack;
+                               dm_tree_set_cookie(dnode, 0);
+                               (void) _dm_tree_revert_activated(child);
+                       }
                        return_0;
                }
 
This page took 0.038699 seconds and 5 git commands to generate.