All of lore.kernel.org
 help / color / mirror / Atom feed
From: agk@sourceware.org <agk@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 ./WHATS_NEW lib/activate/activate.c lib/a ...
Date: 8 Mar 2007 21:08:26 -0000	[thread overview]
Message-ID: <20070308210826.22625.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk at sourceware.org	2007-03-08 21:08:25

Modified files:
	.              : WHATS_NEW 
	lib/activate   : activate.c activate.h 
	tools          : vgrename.c 

Log message:
	Fix vgrename active LV check to ignore differing vgids.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.579&r2=1.580
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.120&r2=1.121
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.h.diff?cvsroot=lvm2&r1=1.54&r2=1.55
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgrename.c.diff?cvsroot=lvm2&r1=1.41&r2=1.42

--- LVM2/WHATS_NEW	2007/03/08 19:58:04	1.579
+++ LVM2/WHATS_NEW	2007/03/08 21:08:25	1.580
@@ -1,5 +1,6 @@
 Version 2.02.23 - 
 ====================================
+  Fix vgrename active LV check to ignore differing vgids.
   Remove no-longer-used uuid_out parameter from activation info functions.
   Fix two more segfaults if an empty config file section encountered.
   Move .cache file into a new /etc/lvm/cache directory by default.
--- LVM2/lib/activate/activate.c	2007/01/24 23:43:27	1.120
+++ LVM2/lib/activate/activate.c	2007/03/08 21:08:25	1.121
@@ -168,6 +168,10 @@
 {
 	return 0;
 }
+int lvs_in_vg_activated_by_uuid_only(struct volume_group *vg);
+{
+	return 0;
+}
 int lvs_in_vg_opened(struct volume_group *vg)
 {
 	return 0;
@@ -421,21 +425,23 @@
  * Returns 1 if info structure populated, else 0 on failure.
  */
 static int _lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int with_mknodes,
-		    struct lvinfo *info, int with_open_count)
+		    struct lvinfo *info, int with_open_count, unsigned by_uuid_only)
 {
 	struct dm_info dminfo;
-	char *name;
+	char *name = NULL;
 
 	if (!activation())
 		return 0;
 
-	if (!(name = build_dm_name(cmd->mem, lv->vg->name, lv->name, NULL)))
+	if (!by_uuid_only &&
+	    !(name = build_dm_name(cmd->mem, lv->vg->name, lv->name, NULL)))
 		return_0;
 
 	log_debug("Getting device info for %s", name);
 	if (!dev_manager_info(lv->vg->cmd->mem, name, lv, with_mknodes,
 			      with_open_count, &dminfo)) {
-		dm_pool_free(cmd->mem, name);
+		if (name)
+			dm_pool_free(cmd->mem, name);
 		return_0;
 	}
 
@@ -448,14 +454,16 @@
 	info->live_table = dminfo.live_table;
 	info->inactive_table = dminfo.inactive_table;
 
-	dm_pool_free(cmd->mem, name);
+	if (name)
+		dm_pool_free(cmd->mem, name);
+
 	return 1;
 }
 
 int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, struct lvinfo *info,
 	    int with_open_count)
 {
-	return _lv_info(cmd, lv, 0, info, with_open_count);
+	return _lv_info(cmd, lv, 0, info, with_open_count, 0);
 }
 
 int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s,
@@ -466,7 +474,7 @@
 	if (!(lv = lv_from_lvid(cmd, lvid_s, 0)))
 		return 0;
 
-	return _lv_info(cmd, lv, 0, info, with_open_count);
+	return _lv_info(cmd, lv, 0, info, with_open_count, 0);
 }
 
 /*
@@ -519,11 +527,12 @@
 	return r;
 }
 
-static int _lv_active(struct cmd_context *cmd, struct logical_volume *lv)
+static int _lv_active(struct cmd_context *cmd, struct logical_volume *lv,
+		      unsigned by_uuid_only)
 {
 	struct lvinfo info;
 
-	if (!lv_info(cmd, lv, &info, 0)) {
+	if (!_lv_info(cmd, lv, 0, &info, 0, by_uuid_only)) {
 		stack;
 		return -1;
 	}
@@ -607,7 +616,7 @@
  * These two functions return the number of visible LVs in the state,
  * or -1 on error.
  */
-int lvs_in_vg_activated(struct volume_group *vg)
+static int _lvs_in_vg_activated(struct volume_group *vg, unsigned by_uuid_only)
 {
 	struct lv_list *lvl;
 	int count = 0;
@@ -617,12 +626,22 @@
 
 	list_iterate_items(lvl, &vg->lvs) {
 		if (lvl->lv->status & VISIBLE_LV)
-			count += (_lv_active(vg->cmd, lvl->lv) == 1);
+			count += (_lv_active(vg->cmd, lvl->lv, by_uuid_only) == 1);
 	}
 
 	return count;
 }
 
+int lvs_in_vg_activated_by_uuid_only(struct volume_group *vg)
+{
+	return _lvs_in_vg_activated(vg, 1);
+}
+
+int lvs_in_vg_activated(struct volume_group *vg)
+{
+	return _lvs_in_vg_activated(vg, 0);
+}
+
 int lvs_in_vg_opened(struct volume_group *vg)
 {
 	struct lv_list *lvl;
@@ -973,7 +992,7 @@
 		return r;
 	}
 
-	if (!_lv_info(cmd, lv, 1, &info, 0))
+	if (!_lv_info(cmd, lv, 1, &info, 0, 0))
 		return_0;
 
 	if (info.exists)
--- LVM2/lib/activate/activate.h	2007/01/25 21:22:30	1.54
+++ LVM2/lib/activate/activate.h	2007/03/08 21:08:25	1.55
@@ -83,6 +83,7 @@
  * Return number of LVs in the VG that are active.
  */
 int lvs_in_vg_activated(struct volume_group *vg);
+int lvs_in_vg_activated_by_uuid_only(struct volume_group *vg);
 int lvs_in_vg_opened(struct volume_group *vg);
 
 
--- LVM2/tools/vgrename.c	2006/09/02 01:18:17	1.41
+++ LVM2/tools/vgrename.c	2007/03/08 21:08:25	1.42
@@ -118,7 +118,7 @@
 		return ECMD_FAILED;
 	}
 
-	if (lvs_in_vg_activated(vg_old)) {
+	if (lvs_in_vg_activated_by_uuid_only(vg_old)) {
 		unlock_vg(cmd, vg_name_old);
 		log_error("Volume group \"%s\" still has active LVs",
 			  vg_name_old);



             reply	other threads:[~2007-03-08 21:08 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-08 21:08 agk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-07-02 11:17 LVM2 ./WHATS_NEW lib/activate/activate.c lib/a wysochanski
2007-11-12 20:51 agk
2008-01-30 14:00 agk
2008-04-07 10:23 mbroz
2008-12-19 14:22 prajnoha
2008-12-19 14:58 ` Alasdair G Kergon
2009-02-28  0:54 agk
2009-05-20  9:52 mbroz
2009-05-20 11:09 mbroz
2009-06-01 12:43 mbroz
2009-10-01  0:35 agk
2010-02-24 20:00 mbroz
2010-02-24 20:01 mbroz
2010-08-17  1:16 agk
2011-02-03  1:24 zkabelac
2011-02-04 19:14 zkabelac
2011-06-17 14:14 zkabelac
2011-07-04 14:55 ` Alasdair G Kergon
2011-06-17 14:22 zkabelac
2011-06-22 21:31 jbrassow
2011-06-30 18:25 agk
2011-09-22 17:33 prajnoha
2011-10-03 18:37 zkabelac
2011-10-06 14:55 jbrassow
2011-11-18 19:31 zkabelac
2012-01-25  8:48 zkabelac
2012-01-25 13:10 zkabelac
2012-02-23 22:42 zkabelac
2012-03-23  9:58 zkabelac

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=20070308210826.22625.qmail@sourceware.org \
    --to=agk@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.