summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2012-02-28 18:08:08 +0000
committerAlasdair Kergon <agk@redhat.com>2012-02-28 18:08:08 +0000
commitdc9ef7a028241cf85d62fb1a9fe27927b8e305bd (patch)
treeaf778ca749c3f02c3b4895f72a6e7b4ea5fbabed
parentebf5552754bdf0d4c04f45bef334799775776ad7 (diff)
downloadlvm2-dc9ef7a028241cf85d62fb1a9fe27927b8e305bd.tar.gz
lvm2-dc9ef7a028241cf85d62fb1a9fe27927b8e305bd.tar.xz
lvm2-dc9ef7a028241cf85d62fb1a9fe27927b8e305bd.zip
Check return values after calling new lvmetad fns
(Haven't checked error path handling though)
-rw-r--r--tools/commands.h2
-rw-r--r--tools/pvremove.c13
-rw-r--r--tools/pvscan.c4
-rw-r--r--tools/toollib.c6
-rw-r--r--tools/vgrename.c4
-rw-r--r--tools/vgscan.c5
6 files changed, 22 insertions, 12 deletions
diff --git a/tools/commands.h b/tools/commands.h
index 3557c3bc..3a968bde 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -670,7 +670,7 @@ xx(pvscan,
"\t[-P|--partial] " "\n"
"\t[-s|--short] " "\n"
"\t[-u|--uuid] " "\n"
- "\t[--lvmetad DEVICE] " "\n"
+ "\t[--lvmetad DevicePath] " "\n"
"\t[-v|--verbose] " "\n"
"\t[--version]\n",
diff --git a/tools/pvremove.c b/tools/pvremove.c
index 655214e0..4c3628b7 100644
--- a/tools/pvremove.c
+++ b/tools/pvremove.c
@@ -107,35 +107,36 @@ static int pvremove_single(struct cmd_context *cmd, const char *pv_name,
}
if (!pvremove_check(cmd, pv_name))
- goto error;
+ goto out;
if (!(dev = dev_cache_get(pv_name, cmd->filter))) {
log_error("%s: Couldn't find device. Check your filters?",
pv_name);
- goto error;
+ goto out;
}
if (!dev_test_excl(dev)) {
/* FIXME Detect whether device-mapper is still using the device */
log_error("Can't open %s exclusively - not removing. "
"Mounted filesystem?", dev_name(dev));
- goto error;
+ goto out;
}
/* Wipe existing label(s) */
if (!label_remove(dev)) {
log_error("Failed to wipe existing label(s) on %s", pv_name);
- goto error;
+ goto out;
}
- lvmetad_pv_gone(dev->dev);
+ if (!lvmetad_pv_gone(dev->dev))
+ goto_out;
log_print("Labels on physical volume \"%s\" successfully wiped",
pv_name);
ret = ECMD_PROCESSED;
- error:
+out:
unlock_vg(cmd, VG_ORPHANS);
return ret;
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 42d49402..7cc9d433 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -116,8 +116,10 @@ int pvscan(struct cmd_context *cmd, int argc, char **argv)
vg_max_name_len = 0;
if (arg_count(cmd, lvmetad_ARG)) {
- if (!pvscan_lvmetad(cmd, argc, argv))
+ if (!pvscan_lvmetad(cmd, argc, argv)) {
+ stack;
return ECMD_FAILED;
+ }
return ECMD_PROCESSED;
}
diff --git a/tools/toollib.c b/tools/toollib.c
index d6862499..f49512e9 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -305,7 +305,8 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
if (!argc || !dm_list_empty(&tags)) {
log_verbose("Finding all logical volumes");
- lvmetad_vg_list_to_lvmcache(cmd);
+ if (!lvmetad_vg_list_to_lvmcache(cmd))
+ stack;
if (!(vgnames = get_vgnames(cmd, 0)) || dm_list_empty(vgnames)) {
log_error("No volume groups found");
return ret_max;
@@ -582,7 +583,8 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
if (!argc || !dm_list_empty(&tags)) {
log_verbose("Finding all volume groups");
- lvmetad_vg_list_to_lvmcache(cmd);
+ if (!lvmetad_vg_list_to_lvmcache(cmd))
+ stack;
if (!(vgids = get_vgids(cmd, 0)) || dm_list_empty(vgids)) {
log_error("No volume groups found");
return ret_max;
diff --git a/tools/vgrename.c b/tools/vgrename.c
index c3e71cef..acd5da3c 100644
--- a/tools/vgrename.c
+++ b/tools/vgrename.c
@@ -79,7 +79,9 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path,
log_verbose("Checking for existing volume group \"%s\"", vg_name_old);
- lvmetad_vg_list_to_lvmcache(cmd); /* populate lvmcache */
+ /* populate lvmcache */
+ if (!lvmetad_vg_list_to_lvmcache(cmd))
+ stack;
/* Avoid duplicates */
if (!(vgids = get_vgids(cmd, 0)) || dm_list_empty(vgids)) {
diff --git a/tools/vgscan.c b/tools/vgscan.c
index df0486f2..a353c432 100644
--- a/tools/vgscan.c
+++ b/tools/vgscan.c
@@ -24,7 +24,10 @@ static int vgscan_single(struct cmd_context *cmd, const char *vg_name,
vg->fid->fmt->name);
check_current_backup(vg);
- lvmetad_vg_update(vg); /* keep lvmetad up to date */
+
+ /* keep lvmetad up to date */
+ if (!lvmetad_vg_update(vg))
+ stack;
return ECMD_PROCESSED;
}