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

activation: extend resume validation

Check also all snapshosts when resume is requested,
the origin volume is already resume, but possibly
some subLV or snapshot LV could be suspended if
we are still in critical_section.
This commit is contained in:
Zdenek Kabelac 2017-11-28 23:11:20 +01:00
parent c086dfadc3
commit e4db42e476

View File

@ -2311,6 +2311,11 @@ static int _check_suspended_lv(struct logical_volume *lv, void *data)
return 0; /* There is suspended subLV in the tree */
}
if (lv_layer(lv) && lv_info(lv->vg->cmd, lv, 1, &info, 0, 0) && info.exists && info.suspended) {
log_debug("Found suspended layered LV %s in critical section().", display_lvname(lv));
return 0; /* There is suspended subLV in the tree */
}
return 1;
}
@ -2319,6 +2324,7 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
const struct logical_volume *lv)
{
const struct logical_volume *lv_to_free = NULL;
struct dm_list *snh;
struct lvinfo info;
int r = 0;
@ -2360,18 +2366,21 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
critical_section_dec(cmd, "resumed");
if (!info.suspended && critical_section()) {
/* check if any subLV is suspended */
if ((r = for_each_sub_lv((struct logical_volume *)lv, &_check_suspended_lv, NULL))) {
/* Everything seems resumed */
log_debug_activation("LV %s not suspended.", display_lvname(lv));
goto out;
/* Validation check if any subLV is suspended */
if (!laopts->origin_only && lv_is_origin(lv)) {
/* Check all snapshots for this origin LV */
dm_list_iterate(snh, &lv->snapshot_segs)
if (!_check_suspended_lv(dm_list_struct_base(snh, struct lv_segment, origin_list)->cow, NULL))
goto needs_resume; /* Found suspended snapshot */
}
if ((r = for_each_sub_lv((struct logical_volume *)lv, &_check_suspended_lv, NULL)))
goto out; /* Nothing was found suspended */
} else {
r = 1;
goto out;
}
}
needs_resume:
laopts->read_only = _passes_readonly_filter(cmd, lv);
laopts->resuming = 1;