1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Only fail if the top-level LV fails to be deactivated - allow deactivation

of its dependencies to fail.
This commit is contained in:
Alasdair Kergon 2010-04-07 23:51:34 +00:00
parent 09d11ca3d8
commit 18e0f9342d

View File

@ -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;