From 17b27464868ac7049624d9b90f68c59200866997 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 9 Jun 2021 16:16:26 +0200 Subject: [PATCH 6/8] archive: avoid abuse of internal flag Since archive is now postponned we use internal variable 'changed' to mark we need to commit new metadata. Signed-off-by: Heming Zhao --- tools/vgchange.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/vgchange.c b/tools/vgchange.c index 9f972acdb4da..22038ba9b7da 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -640,6 +640,7 @@ static int _vgchange_single(struct cmd_context *cmd, const char *vg_name, int ret = ECMD_PROCESSED; unsigned i; activation_change_t activate; + int changed = 0; static const struct { int arg; @@ -677,10 +678,11 @@ static int _vgchange_single(struct cmd_context *cmd, const char *vg_name, if (arg_is_set(cmd, _vgchange_args[i].arg)) { if (!_vgchange_args[i].fn(cmd, vg)) return_ECMD_FAILED; + changed = 1; } } - if (vg_is_archived(vg)) { + if (changed) { if (!vg_write(vg) || !vg_commit(vg)) return_ECMD_FAILED; -- 1.8.3.1