summaryrefslogtreecommitdiffstats
path: root/tools/vgimport.c
diff options
context:
space:
mode:
authorMilan Broz <mbroz@redhat.com>2009-06-05 20:00:52 +0000
committerMilan Broz <mbroz@redhat.com>2009-06-05 20:00:52 +0000
commit66086ce962c17a86bf6a1e984d716ef71b7b3441 (patch)
treefd6d398a3567ebd6a03af3d21de5778c6bdb7e61 /tools/vgimport.c
parent89b7d5cb4c2ebfc0a045a69902257785db3f5b27 (diff)
downloadlvm2-66086ce962c17a86bf6a1e984d716ef71b7b3441.tar.gz
lvm2-66086ce962c17a86bf6a1e984d716ef71b7b3441.tar.xz
lvm2-66086ce962c17a86bf6a1e984d716ef71b7b3441.zip
Fix double releasing of vg when repairing of vg is requested.
Several commands calls process_each_vg() and in provided callback it explicitly recovers VG if inconsistent. (vgchange, vgconvert, vgscan) It means that old VG is released and reread but the function above (process_one_vg) tries to unlock and release old VG. Patch moves the repair logic into _process_one_vg() function. It always tries to read vg (even inconsistent) and then decides what to do according new defined parameter. Also patch unifies inconsistent error messages. The only slight change if for vgremove command, where it now tries to repair VG before it removes if force arg is given. (It works similar way before, just the order of operation changed).
Diffstat (limited to 'tools/vgimport.c')
-rw-r--r--tools/vgimport.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/tools/vgimport.c b/tools/vgimport.c
index 25ab0359..2be2c2fd 100644
--- a/tools/vgimport.c
+++ b/tools/vgimport.c
@@ -23,12 +23,6 @@ static int vgimport_single(struct cmd_context *cmd __attribute((unused)),
struct pv_list *pvl;
struct physical_volume *pv;
- if (!vg || !consistent) {
- log_error("Unable to find exported volume group \"%s\"",
- vg_name);
- goto error;
- }
-
if (!(vg_status(vg) & EXPORTED_VG)) {
log_error("Volume group \"%s\" is not exported", vg_name);
goto error;
@@ -74,6 +68,7 @@ int vgimport(struct cmd_context *cmd, int argc, char **argv)
return ECMD_FAILED;
}
- return process_each_vg(cmd, argc, argv, LCK_VG_WRITE, 1, NULL,
+ return process_each_vg(cmd, argc, argv, LCK_VG_WRITE,
+ VG_INCONSISTENT_ABORT, NULL,
&vgimport_single);
}