mirror of
git://sourceware.org/git/lvm2.git
synced 2025-08-03 08:22:00 +03:00
lockd: check for failing unlock
Avoid ignoring unlocking error.
This commit is contained in:
@ -3450,7 +3450,10 @@ bad:
|
||||
unlock_vg(cmd, lp->vg_name);
|
||||
|
||||
/* Unlock here so it's not held during polling. */
|
||||
lockd_vg(cmd, lp->vg_name, "un", 0, &lockd_state);
|
||||
if (!lockd_vg(cmd, lp->vg_name, "un", 0, &lockd_state)) {
|
||||
stack;
|
||||
ret = ECMD_FAILED;
|
||||
}
|
||||
|
||||
release_vg(vg);
|
||||
out:
|
||||
|
@ -202,7 +202,8 @@ int wait_for_single_lv(struct cmd_context *cmd, struct poll_operation_id *id,
|
||||
|
||||
unlock_and_release_vg(cmd, vg, vg->name);
|
||||
|
||||
lockd_vg(cmd, id->vg_name, "un", 0, &lockd_state);
|
||||
if (!lockd_vg(cmd, id->vg_name, "un", 0, &lockd_state))
|
||||
return_0;
|
||||
|
||||
/*
|
||||
* FIXME Sleeping after testing, while preferred, also works around
|
||||
@ -225,7 +226,11 @@ int wait_for_single_lv(struct cmd_context *cmd, struct poll_operation_id *id,
|
||||
out:
|
||||
if (vg)
|
||||
unlock_and_release_vg(cmd, vg, vg->name);
|
||||
lockd_vg(cmd, id->vg_name, "un", 0, &lockd_state);
|
||||
if (!lockd_vg(cmd, id->vg_name, "un", 0, &lockd_state)) {
|
||||
stack;
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -712,7 +712,10 @@ out_ret:
|
||||
* for some time monitoring the progress, and we don not want
|
||||
* or need the lockd lock held over that.
|
||||
*/
|
||||
lockd_vg(cmd, vg_name, "un", 0, &lockd_state);
|
||||
if (!lockd_vg(cmd, vg_name, "un", 0, &lockd_state)) {
|
||||
stack;
|
||||
r = ECMD_FAILED;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
@ -762,7 +765,10 @@ static int _read_poll_id_from_pvname(struct cmd_context *cmd, const char *pv_nam
|
||||
|
||||
unlock_and_release_vg(cmd, vg, vg_name);
|
||||
out:
|
||||
lockd_vg(cmd, vg_name, "un", 0, &lockd_state);
|
||||
if (!lockd_vg(cmd, vg_name, "un", 0, &lockd_state)) {
|
||||
stack;
|
||||
ret = 0;
|
||||
}
|
||||
free_pv_fid(pv);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1957,7 +1957,10 @@ static int _process_vgnameid_list(struct cmd_context *cmd, uint32_t flags,
|
||||
unlock_vg(cmd, vg_name);
|
||||
endvg:
|
||||
release_vg(vg);
|
||||
lockd_vg(cmd, vg_name, "un", 0, &lockd_state);
|
||||
if (!lockd_vg(cmd, vg_name, "un", 0, &lockd_state)) {
|
||||
stack;
|
||||
ret_max = ECMD_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
/* the VG is selected if at least one LV is selected */
|
||||
@ -2438,7 +2441,10 @@ static int _process_lv_vgnameid_list(struct cmd_context *cmd, uint32_t flags,
|
||||
unlock_vg(cmd, vg_name);
|
||||
endvg:
|
||||
release_vg(vg);
|
||||
lockd_vg(cmd, vg_name, "un", 0, &lockd_state);
|
||||
if (!lockd_vg(cmd, vg_name, "un", 0, &lockd_state)) {
|
||||
stack;
|
||||
ret_max = ECMD_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
return ret_max;
|
||||
@ -2942,7 +2948,10 @@ static int _process_pvs_in_vgs(struct cmd_context *cmd, uint32_t flags,
|
||||
unlock_vg(cmd, vg->name);
|
||||
endvg:
|
||||
release_vg(vg);
|
||||
lockd_vg(cmd, vg_name, "un", 0, &lockd_state);
|
||||
if (!lockd_vg(cmd, vg_name, "un", 0, &lockd_state)) {
|
||||
stack;
|
||||
ret_max = ECMD_FAILED;
|
||||
}
|
||||
|
||||
/* Quit early when possible. */
|
||||
if (!process_all_pvs && dm_list_empty(arg_tags) && dm_list_empty(arg_devices))
|
||||
|
@ -1227,7 +1227,8 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
|
||||
if (arg_is_set(cmd, lockstart_ARG)) {
|
||||
const char *start_opt = arg_str_value(cmd, lockopt_ARG, NULL);
|
||||
|
||||
lockd_gl(cmd, "un", 0);
|
||||
if (!lockd_gl(cmd, "un", 0))
|
||||
return_ECMD_FAILED;
|
||||
|
||||
if (!start_opt || !strcmp(start_opt, "auto")) {
|
||||
log_print_unless_silent("Starting locking. Waiting until locks are ready...");
|
||||
|
Reference in New Issue
Block a user