From b5fd1544d5abd61012a672b24b99b72dcafb47a1 Mon Sep 17 00:00:00 2001 From: Dave Wysochanski Date: Wed, 15 Jul 2009 05:23:19 +0000 Subject: [PATCH] Check for certain vg_read errors in _process_one_vg iterator. In _process_one_vg, we should never proceed if the VG read fails with certain conditions. If we cannot allocate or construct the volume_group structure, we should not proceed - this is true regardless of the tool calling the iterator. In other cases, when the volume group structure is constructed but there is some error (PVs missing, metadata corrupted, etc), some tools may want to process the VG while others may not. Author: Dave Wysochanski --- tools/toollib.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/toollib.c b/tools/toollib.c index 248fafbb9..0df5d6643 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -431,6 +431,9 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name, log_verbose("Finding volume group \"%s\"", vg_name); vg = vg_read(cmd, vg_name, vgid, flags); + if (vg_read_error(vg) == FAILED_ALLOCATION || + vg_read_error(vg) == FAILED_NOTFOUND) + return ECMD_FAILED; if (!dm_list_empty(tags)) { /* Only process if a tag matches or it's on arg_vgnames */