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

lockd: no error when unlock fails

The unlock call will fail in expected and normal cases,
and should not cause the command to fail.  (An actual
unlock in the lock manager should never fail.)
This commit is contained in:
David Teigland 2015-08-18 10:39:40 -05:00
parent c1bd76d6fc
commit 7b570840cd
5 changed files with 9 additions and 23 deletions

View File

@ -3450,10 +3450,8 @@ bad:
unlock_vg(cmd, lp->vg_name);
/* Unlock here so it's not held during polling. */
if (!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:

View File

@ -203,7 +203,7 @@ int wait_for_single_lv(struct cmd_context *cmd, struct poll_operation_id *id,
unlock_and_release_vg(cmd, vg, vg->name);
if (!lockd_vg(cmd, id->vg_name, "un", 0, &lockd_state))
return_0;
stack;
/*
* FIXME Sleeping after testing, while preferred, also works around
@ -226,10 +226,8 @@ 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);
if (!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;
}

View File

@ -712,10 +712,8 @@ out_ret:
* for some time monitoring the progress, and we don not want
* or need the lockd lock held over that.
*/
if (!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;
}
@ -765,10 +763,8 @@ static int _read_poll_id_from_pvname(struct cmd_context *cmd, const char *pv_nam
unlock_and_release_vg(cmd, vg, vg_name);
out:
if (!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;
}

View File

@ -1957,10 +1957,8 @@ static int _process_vgnameid_list(struct cmd_context *cmd, uint32_t flags,
unlock_vg(cmd, vg_name);
endvg:
release_vg(vg);
if (!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 */
@ -2441,10 +2439,8 @@ static int _process_lv_vgnameid_list(struct cmd_context *cmd, uint32_t flags,
unlock_vg(cmd, vg_name);
endvg:
release_vg(vg);
if (!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;
@ -2948,10 +2944,8 @@ static int _process_pvs_in_vgs(struct cmd_context *cmd, uint32_t flags,
unlock_vg(cmd, vg->name);
endvg:
release_vg(vg);
if (!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))

View File

@ -1228,7 +1228,7 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
const char *start_opt = arg_str_value(cmd, lockopt_ARG, NULL);
if (!lockd_gl(cmd, "un", 0))
return_ECMD_FAILED;
stack;
if (!start_opt || !strcmp(start_opt, "auto")) {
log_print_unless_silent("Starting locking. Waiting until locks are ready...");