All of lore.kernel.org
 help / color / mirror / Atom feed
From: Milan Broz <mbroz@redhat.com>
To: lvm-devel@redhat.com
Subject: LVM2 ./WHATS_NEW lib/activate/activate.h lib/a ...
Date: Fri, 14 May 2010 11:00:58 +0200	[thread overview]
Message-ID: <4BED114A.1090507@redhat.com> (raw)
In-Reply-To: <20100513234711.GP2377@agk-dp.fab.redhat.com>

On 05/14/2010 01:47 AM, Alasdair G Kergon wrote:
> Mixing up types there.
> name is a dm device name
>
>   
yep. ok with that patch? (we have no mempool available there, that's why
dm_strdup)

diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 710b3ae..d01bd63 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -133,7 +133,7 @@ int device_is_usable(struct device *dev)
 	const char *name, *uuid;
 	uint64_t start, length;
 	char *target_type = NULL;
-	char *params;
+	char *params, *vgname = NULL, *lvname, *layer;
 	void *next = NULL;
 	int r = 0;
 
@@ -175,15 +175,23 @@ int device_is_usable(struct device *dev)
 	/* FIXME Also check dependencies? */
 
 	/* Check internal lvm devices */
-	if (is_reserved_lvname(name) && uuid &&
-	    !strncmp(uuid, UUID_PREFIX, sizeof(UUID_PREFIX) - 1)) {
-		log_debug("%s: Reserved internal LVM device not usable.", dev_name(dev));
-		goto out;
+	if (uuid && !strncmp(uuid, UUID_PREFIX, sizeof(UUID_PREFIX) - 1)) {
+		if (!(vgname = dm_strdup(name)) ||
+		    !dm_split_lvm_name(NULL, NULL, &vgname, &lvname, &layer))
+			goto_out;
+
+		if (lvname && is_reserved_lvname(lvname)) {
+			log_debug("%s: Reserved internal LV device %s/%s not usable.",
+				  dev_name(dev), vgname, lvname);
+			goto out;
+		}
 	}
 
 	r = 1;
 
       out:
+	if (vgname)
+		dm_free(vgname);
 	dm_task_destroy(dmt);
 	return r;
 }




  reply	other threads:[~2010-05-14  9:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-13 18:38 LVM2 ./WHATS_NEW lib/activate/activate.h lib/a mbroz
2010-05-13 23:47 ` Alasdair G Kergon
2010-05-14  9:00   ` Milan Broz [this message]
2010-05-14  9:05     ` Zdenek Kabelac
  -- strict thread matches above, loose matches on Subject: below --
2010-04-23  2:57 snitzer

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=4BED114A.1090507@redhat.com \
    --to=mbroz@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.