All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Rajnoha <prajnoha@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH][lvmetad] Restore lvmetad active state during vgscan to populate lvmetad
Date: Tue, 20 Mar 2012 14:29:52 +0100	[thread overview]
Message-ID: <4F688650.8020505@redhat.com> (raw)

lvmetad_vg_update does nothing for inactive lvmetad state so
restore it in the vgscan_single temporarily...

Or should we abandon the vgscan in case we're using lvmetad
and allow only "pvscan --cache"???

Peter
---
 tools/vgscan.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/vgscan.c b/tools/vgscan.c
index a353c43..f7fbd54 100644
--- a/tools/vgscan.c
+++ b/tools/vgscan.c
@@ -15,6 +15,8 @@
 
 #include "tools.h"
 
+static int _lvmetad;
+
 static int vgscan_single(struct cmd_context *cmd, const char *vg_name,
 			 struct volume_group *vg,
 			 void *handle __attribute__((unused)))
@@ -25,16 +27,18 @@ static int vgscan_single(struct cmd_context *cmd, const char *vg_name,
 
 	check_current_backup(vg);
 
-	/* keep lvmetad up to date */
+	/* keep lvmetad up to date, restore the "active" state temporarily */
+	lvmetad_set_active(_lvmetad);
 	if (!lvmetad_vg_update(vg))
 		stack;
+	lvmetad_set_active(0);
 
 	return ECMD_PROCESSED;
 }
 
 int vgscan(struct cmd_context *cmd, int argc, char **argv)
 {
-	int maxret, ret, lvmetad;
+	int maxret, ret;
 
 	if (argc) {
 		log_error("Too many parameters on command line");
@@ -48,7 +52,7 @@ int vgscan(struct cmd_context *cmd, int argc, char **argv)
 
 	persistent_filter_wipe(cmd->filter);
 	lvmcache_destroy(cmd, 1);
-	lvmetad = lvmetad_active();
+	_lvmetad = lvmetad_active();
 	lvmetad_set_active(0); /* do not rely on lvmetad info */
 
 	log_print("Reading all physical volumes.  This may take a while...");
@@ -62,7 +66,7 @@ int vgscan(struct cmd_context *cmd, int argc, char **argv)
 			maxret = ret;
 	}
 
-	lvmetad_set_active(lvmetad); /* restore */
+	lvmetad_set_active(_lvmetad); /* restore */
 	unlock_vg(cmd, VG_GLOBAL);
 	return maxret;
 }



                 reply	other threads:[~2012-03-20 13:29 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=4F688650.8020505@redhat.com \
    --to=prajnoha@redhat.com \
    --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.