lvm2/0126-vgsplit-don-t-reread-vg_to.patch

54 lines
1.6 KiB
Diff
Raw Normal View History

From b7334daa69e998b604f59697d7614c54d6373160 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Wed, 12 Jan 2022 16:42:01 -0600
Subject: [PATCH 09/12] vgsplit: don't reread vg_to
The destination vg is first written with the EXPORTED flag,
then the source vg is written, then the destination vg is
written again without the EXPORTED flag. Remove an unnecessary
vg_read of the destination vg just before the second write.
(cherry picked from commit 5e428d22d9647a294eba65852078947df5ade48f)
---
tools/vgsplit.c | 24 ------------------------
1 file changed, 24 deletions(-)
diff --git a/tools/vgsplit.c b/tools/vgsplit.c
index 9d6534e89..c7f4b8af4 100644
--- a/tools/vgsplit.c
+++ b/tools/vgsplit.c
@@ -728,30 +728,6 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
backup(vg_from);
}
- /*
- * Finally, remove the EXPORTED flag from the new VG and write it out.
- * We need to unlock vg_to because vg_read_for_update wants to lock it.
- */
- if (!test_mode()) {
- unlock_vg(cmd, NULL, vg_name_to);
- release_vg(vg_to);
-
- /*
- * This command uses the exported vg flag internally, but
- * exported VGs are not allowed to be split from the command
- * level, so ALLOW_EXPORTED is not set in commands.h.
- */
- cmd->include_exported_vgs = 1;
-
- vg_to = vg_read_for_update(cmd, vg_name_to, NULL, 0, 0);
-
- if (!vg_to) {
- log_error("Volume group \"%s\" became inconsistent: "
- "please fix manually", vg_name_to);
- goto bad;
- }
- }
-
vg_to->status &= ~EXPORTED_VG;
if (!vg_write(vg_to) || !vg_commit(vg_to))
--
2.43.0