struct dm_tree_node *child;
char *vgname, *lvname, *layer;
const char *name, *uuid;
- int r;
while ((child = dm_tree_next_child(&handle, root, 0))) {
if (!(name = dm_tree_node_get_name(child)))
if (non_toplevel_tree_dlid && !strcmp(non_toplevel_tree_dlid, uuid))
continue;
- dm_tree_set_cookie(root, 0);
- r = dm_tree_deactivate_children(root, uuid, strlen(uuid));
- if (!dm_udev_wait(dm_tree_get_cookie(root)))
- stack;
-
- if (!r)
+ if (!dm_tree_deactivate_children(root, uuid, strlen(uuid)))
return_0;
}
if (!(root = dm_tree_find_node(dtree, 0, 0))) {
log_error("Lost dependency tree root node");
- goto out;
+ goto out_no_root;
}
+ /* Restore fs cookie */
+ dm_tree_set_cookie(root, fs_get_cookie());
+
if (!(dlid = build_dm_uuid(dm->mem, lv->lvid.s, origin_only ? "real" : NULL)))
goto_out;
break;
case DEACTIVATE:
/* Deactivate LV and all devices it references that nothing else has open. */
- dm_tree_set_cookie(root, 0);
r = dm_tree_deactivate_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1);
- if (!dm_udev_wait(dm_tree_get_cookie(root)))
- stack;
if (!r)
goto_out;
if (!_remove_lv_symlinks(dm, root))
goto_out;
/* Preload any devices required before any suspensions */
- dm_tree_set_cookie(root, 0);
r = dm_tree_preload_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1);
- if (!dm_udev_wait(dm_tree_get_cookie(root)))
- stack;
if (!r)
goto_out;
dm->flush_required = 1;
if (action == ACTIVATE) {
- dm_tree_set_cookie(root, 0);
r = dm_tree_activate_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1);
- if (!dm_udev_wait(dm_tree_get_cookie(root)))
- stack;
if (!r)
goto_out;
if (!_create_lv_symlinks(dm, root)) {
r = 1;
out:
+ /* Save fs cookie for udev settle, do not wait here */
+ fs_set_cookie(dm_tree_get_cookie(root));
+out_no_root:
dm_tree_free(dtree);
return r;
const char *lv_name, int check_udev);
int fs_rename_lv(struct logical_volume *lv, const char *dev,
const char *old_vgname, const char *old_lvname);
-void fs_unlock(void);
+/* void fs_unlock(void); moved to activate.h */
uint32_t fs_get_cookie(void);
void fs_set_cookie(uint32_t cookie);