mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
pvchange: fix exit code regression
Commit 1a832398a7
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 -
|
||||
====================================
|
||||
Fix exit code regression in failing pvchange command (2.02.66).
|
||||
Include 'lvm dumpconfig --type missing' and '--type diff' output to lvmdump.
|
||||
Return failure when specifying negative size for pvresize.
|
||||
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) {
|
||||
log_verbose("Using physical volume(s) on command line");
|
||||
for (; opt < argc; opt++) {
|
||||
total++;
|
||||
pv_name = argv[opt];
|
||||
dm_unescape_colons_and_at_signs(pv_name, NULL, NULL);
|
||||
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);
|
||||
if (!pvl || !pvl->pv) {
|
||||
unlock_and_release_vg(cmd, vg, vg_name);
|
||||
log_error("Unable to find %s in %s",
|
||||
pv_name, vg_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
total++;
|
||||
done += _pvchange_single(cmd, vg,
|
||||
pvl->pv, NULL);
|
||||
unlock_and_release_vg(cmd, vg, vg_name);
|
||||
|
Loading…
Reference in New Issue
Block a user