mirror of
git://sourceware.org/git/lvm2.git
synced 2025-08-31 09:49:29 +03:00
activate: cleanup lv_check_not_in_use
Reindent lv_check_not_in_use to simplify internal loop code. Also return always '0/1' (drop -1) - since we only check for failure (0) - and we don't really know why lv_info() has failed.
This commit is contained in:
@ -719,22 +719,21 @@ int lv_check_not_in_use(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
open_count_check_retries = retry_deactivation() ? OPEN_COUNT_CHECK_RETRIES : 1;
|
open_count_check_retries = retry_deactivation() ? OPEN_COUNT_CHECK_RETRIES : 1;
|
||||||
while (open_count_check_retries--) {
|
while (info->open_count > 0 && open_count_check_retries--) {
|
||||||
if (info->open_count > 0) {
|
if (!open_count_check_retries) {
|
||||||
if (open_count_check_retries) {
|
|
||||||
usleep(OPEN_COUNT_CHECK_USLEEP_DELAY);
|
|
||||||
log_debug_activation("Retrying open_count check for %s/%s.",
|
|
||||||
lv->vg->name, lv->name);
|
|
||||||
if (!lv_info(cmd, lv, 0, info, 1, 0))
|
|
||||||
return -1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
log_error("Logical volume %s/%s in use.",
|
log_error("Logical volume %s/%s in use.",
|
||||||
lv->vg->name, lv->name);
|
lv->vg->name, lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
}
|
||||||
|
|
||||||
|
usleep(OPEN_COUNT_CHECK_USLEEP_DELAY * 4);
|
||||||
|
log_debug_activation("Retrying open_count check for %s/%s.",
|
||||||
|
lv->vg->name, lv->name);
|
||||||
|
if (!lv_info(cmd, lv, 0, info, 1, 0)) {
|
||||||
|
stack; /* device dissappeared? */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user