]> sourceware.org Git - lvm2.git/commitdiff
activation: add synchronization point
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 16 Aug 2019 21:49:59 +0000 (23:49 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Tue, 20 Aug 2019 10:46:11 +0000 (12:46 +0200)
Resuming of 'error' table entry followed with it's dirrect removal
is now troublesame with latest udev as it may skip processing of
udev rules for already 'dropped' device nodes.

As we cannot 'synchronize' with udev while we know we have devices
in suspended state - rework 'cleanup' so it collects nodes
for removal into pending_delete list and process the list with
synchronization once we are without any suspended nodes.

WHATS_NEW
lib/activate/dev_manager.c

index 2c1bc1625b29fb7400e84d983e7c4fc94b990ae0..0b48e032b05e6fd25e5930f3cda106385db3f0b9 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.03.06 - 
 ================================
+  Synchronize with udev when dropping snapshot.
   Add missing device synchronization point before removing pvmove node.
   Correctly set read_ahead for LVs when pvmove is finished.
   Remove unsupported OPTIONS+="event_timeout" udev rule from 11-dm-lvm.rules.
index b218225bb232ec8d3a36d7af0c572d64c64dc51f..3168e880311810609a2ad92903799701eb9cae62 100644 (file)
@@ -3579,13 +3579,6 @@ static int _clean_tree(struct dev_manager *dm, struct dm_tree_node *root, const
        const char *name, *uuid;
        struct dm_str_list *dl;
 
-       /* Deactivate any tracked pending delete nodes */
-       dm_list_iterate_items(dl, &dm->pending_delete) {
-               log_debug_activation("Deleting tracked UUID %s.", dl->str);
-               if (!dm_tree_deactivate_children(root, dl->str, strlen(dl->str)))
-                       return_0;
-       }
-
        while ((child = dm_tree_next_child(&handle, root, 0))) {
                if (!(name = dm_tree_node_get_name(child)))
                        continue;
@@ -3606,10 +3599,21 @@ static int _clean_tree(struct dev_manager *dm, struct dm_tree_node *root, const
                if (non_toplevel_tree_dlid && !strcmp(non_toplevel_tree_dlid, uuid))
                        continue;
 
-               if (!dm_tree_deactivate_children(root, uuid, strlen(uuid)))
+               if (!str_list_add(dm->mem, &dm->pending_delete, uuid))
                        return_0;
        }
 
+       /* Deactivate any tracked pending delete nodes */
+       if (!dm_list_empty(&dm->pending_delete) && !dm_get_suspended_counter()) {
+               fs_unlock();
+               dm_tree_set_cookie(root, fs_get_cookie());
+               dm_list_iterate_items(dl, &dm->pending_delete) {
+                       log_debug_activation("Deleting tracked UUID %s.", dl->str);
+                       if (!dm_tree_deactivate_children(root, dl->str, strlen(dl->str)))
+                               return_0;
+               }
+       }
+
        return 1;
 }
 
This page took 0.059312 seconds and 5 git commands to generate.