diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index d4beeac51..eb7434068 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -1013,9 +1013,13 @@ static int _suspend_node(const char *name, uint32_t major, uint32_t minor, return r; } -int dm_tree_deactivate_children(struct dm_tree_node *dnode, - const char *uuid_prefix, - size_t uuid_prefix_len) +/* + * FIXME Don't attempt to deactivate known internal dependencies. + */ +static int _dm_tree_deactivate_children(struct dm_tree_node *dnode, + const char *uuid_prefix, + size_t uuid_prefix_len, + unsigned level) { int r = 1; void *handle = NULL; @@ -1051,10 +1055,13 @@ int dm_tree_deactivate_children(struct dm_tree_node *dnode, continue; if (info.open_count) { - log_error("Unable to deactivate open %s (%" PRIu32 - ":%" PRIu32 ")", name, info.major, - info.minor); - r = 0; + /* Only report error from (likely non-internal) dependency at top level */ + if (!level) { + log_error("Unable to deactivate open %s (%" PRIu32 + ":%" PRIu32 ")", name, info.major, + info.minor); + r = 0; + } continue; } @@ -1067,14 +1074,22 @@ int dm_tree_deactivate_children(struct dm_tree_node *dnode, continue; } - if (dm_tree_node_num_children(child, 0)) - if (!dm_tree_deactivate_children(child, uuid_prefix, uuid_prefix_len)) + if (dm_tree_node_num_children(child, 0)) { + if (!_dm_tree_deactivate_children(child, uuid_prefix, uuid_prefix_len, level + 1)) return_0; + } } return r; } +int dm_tree_deactivate_children(struct dm_tree_node *dnode, + const char *uuid_prefix, + size_t uuid_prefix_len) +{ + return _dm_tree_deactivate_children(dnode, uuid_prefix, uuid_prefix_len, 0); +} + void dm_tree_skip_lockfs(struct dm_tree_node *dnode) { dnode->dtree->skip_lockfs = 1;