mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
pvchange: fix exit code regression
Commit 1a832398a7caa96faab2ccbac773cc4047c8f9c1 moved some code from _pvchange_single() to main pvchange() and introduced exit code regression as return codes have not been properly changed, thus pvchange command exited with '0' exit code, even though it has reported error. Also there is a missing vg unlock in error path. Fix it by counting the total number of expected calls before checking for pvname and also unlock and relase vg when pv is not found.
This commit is contained in:
parent
2a93eba68e
commit
80fe100afa
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.106 -
|
Version 2.02.106 -
|
||||||
====================================
|
====================================
|
||||||
|
Fix exit code regression in failing pvchange command (2.02.66).
|
||||||
Include 'lvm dumpconfig --type missing' and '--type diff' output to lvmdump.
|
Include 'lvm dumpconfig --type missing' and '--type diff' output to lvmdump.
|
||||||
Return failure when specifying negative size for pvresize.
|
Return failure when specifying negative size for pvresize.
|
||||||
Fix memory corruption in cmd context refresh if clvmd leaks opened device.
|
Fix memory corruption in cmd context refresh if clvmd leaks opened device.
|
||||||
|
@ -184,6 +184,7 @@ int pvchange(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
if (argc) {
|
if (argc) {
|
||||||
log_verbose("Using physical volume(s) on command line");
|
log_verbose("Using physical volume(s) on command line");
|
||||||
for (; opt < argc; opt++) {
|
for (; opt < argc; opt++) {
|
||||||
|
total++;
|
||||||
pv_name = argv[opt];
|
pv_name = argv[opt];
|
||||||
dm_unescape_colons_and_at_signs(pv_name, NULL, NULL);
|
dm_unescape_colons_and_at_signs(pv_name, NULL, NULL);
|
||||||
vg_name = find_vgname_from_pvname(cmd, pv_name);
|
vg_name = find_vgname_from_pvname(cmd, pv_name);
|
||||||
@ -200,12 +201,12 @@ int pvchange(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
pvl = find_pv_in_vg(vg, pv_name);
|
pvl = find_pv_in_vg(vg, pv_name);
|
||||||
if (!pvl || !pvl->pv) {
|
if (!pvl || !pvl->pv) {
|
||||||
|
unlock_and_release_vg(cmd, vg, vg_name);
|
||||||
log_error("Unable to find %s in %s",
|
log_error("Unable to find %s in %s",
|
||||||
pv_name, vg_name);
|
pv_name, vg_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
total++;
|
|
||||||
done += _pvchange_single(cmd, vg,
|
done += _pvchange_single(cmd, vg,
|
||||||
pvl->pv, NULL);
|
pvl->pv, NULL);
|
||||||
unlock_and_release_vg(cmd, vg, vg_name);
|
unlock_and_release_vg(cmd, vg, vg_name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user