From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - toollib: avoid repeated remove of online vg
Date: Mon, 20 Dec 2021 15:14:04 +0000 (GMT) [thread overview]
Message-ID: <20211220151404.EA9B33858409@sourceware.org> (raw)
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ed1651d11f42ea7157b7b0aebf498b97e56b98aa
Commit: ed1651d11f42ea7157b7b0aebf498b97e56b98aa
Parent: 522561e64b5fe73cb9d01c2ee2d4b7624b0ddff4
Author: Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate: Fri Dec 17 13:18:56 2021 +0100
Committer: Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Mon Dec 20 16:13:28 2021 +0100
toollib: avoid repeated remove of online vg
Call just once unlink after every deactivation of LV from VG.
---
lib/commands/toolcontext.h | 1 +
tools/toollib.c | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index fb7182db6..4d7d4630d 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -202,6 +202,7 @@ struct cmd_context {
unsigned backup_disabled:1; /* skip repeated debug message */
unsigned event_activation:1; /* whether event_activation is set */
unsigned udevoutput:1;
+ unsigned online_vg_file_removed:1;
/*
* Devices and filtering.
diff --git a/tools/toollib.c b/tools/toollib.c
index 33b704134..3b3a20689 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -829,8 +829,11 @@ int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,
* user may want to take charge of activation changes to the VG
* and not have the system autoactivation interfere.
*/
- if (!is_change_activating(activate) && cmd->event_activation)
+ if (!is_change_activating(activate) && cmd->event_activation &&
+ !cmd->online_vg_file_removed) {
+ cmd->online_vg_file_removed = 1;
online_vg_file_remove(lv->vg->name);
+ }
set_lv_notify(lv->vg->cmd);
@@ -2983,6 +2986,8 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
struct glv_list *glvl, *tglvl;
int do_report_ret_code = 1;
+ cmd->online_vg_file_removed = 0;
+
log_set_report_object_type(LOG_REPORT_OBJECT_TYPE_LV);
vg_uuid[0] = '\0';
reply other threads:[~2021-12-20 15:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211220151404.EA9B33858409@sourceware.org \
--to=zkabelac@sourceware.org \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.