mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
activation: check subLV before skipping resume
LV is asked for resume, and its already resume and tool is inside 'critical_section()' check if there is any suspended sub LV. In that case 'resume' operation will not be skipped.
This commit is contained in:
parent
c820b43fc0
commit
9e2a68a981
@ -2276,6 +2276,17 @@ int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned o
|
||||
return _lv_suspend(cmd, lvid_s, &laopts, 0, lv, lv_pre);
|
||||
}
|
||||
|
||||
static int _check_suspended_lv(struct logical_volume *lv, void *data)
|
||||
{
|
||||
struct lvinfo info;
|
||||
|
||||
if (lv_info(lv->vg->cmd, lv, 0, &info, 0, 0) && info.exists && info.suspended) {
|
||||
log_debug("Found suspended LV %s in critical section().", display_lvname(lv));
|
||||
return 0; /* There is suspended subLV in the tree */
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
|
||||
struct lv_activate_opts *laopts, int error_if_not_active,
|
||||
@ -2315,11 +2326,19 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
|
||||
if (!info.exists || !info.suspended) {
|
||||
if (error_if_not_active)
|
||||
goto_out;
|
||||
r = 1;
|
||||
if (!info.suspended)
|
||||
|
||||
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 */
|
||||
critical_section_dec(cmd, "already resumed");
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
r = 1;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
laopts->read_only = _passes_readonly_filter(cmd, lv);
|
||||
laopts->resuming = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user