summaryrefslogtreecommitdiff
path: root/tools/vgcfgbackup.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/vgcfgbackup.c')
-rw-r--r--tools/vgcfgbackup.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/vgcfgbackup.c b/tools/vgcfgbackup.c
index 2d77e650d..c8ae40ccb 100644
--- a/tools/vgcfgbackup.c
+++ b/tools/vgcfgbackup.c
@@ -48,12 +48,15 @@ static char *_expand_filename(const char *template, const char *vg_name,
}
static int vg_backup_single(struct cmd_context *cmd, const char *vg_name,
- struct volume_group *vg, int consistent,
+ struct volume_group *vg,
void *handle)
{
char **last_filename = (char **)handle;
char *filename;
+ if (vg_read_error(vg) && !vg_read_error(vg) == FAILED_INCONSISTENT)
+ return ECMD_FAILED;
+
if (arg_count(cmd, file_ARG)) {
if (!(filename = _expand_filename(arg_value(cmd, file_ARG),
vg->name, last_filename))) {
@@ -64,7 +67,7 @@ static int vg_backup_single(struct cmd_context *cmd, const char *vg_name,
if (!backup_to_file(filename, vg->cmd->cmd_line, vg))
return ECMD_FAILED;
} else {
- if (!consistent) {
+ if (vg_read_error(vg) == FAILED_INCONSISTENT) {
log_error("No backup taken: specify filename with -f "
"to backup an inconsistent VG");
stack;
@@ -90,8 +93,7 @@ int vgcfgbackup(struct cmd_context *cmd, int argc, char **argv)
init_pvmove(1);
- ret = process_each_vg(cmd, argc, argv, LCK_VG_READ,
- VG_INCONSISTENT_CONTINUE,
+ ret = process_each_vg(cmd, argc, argv, 0,
&last_filename, &vg_backup_single);
dm_free(last_filename);