public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: agk@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW lib/device/dev-cache.c
Date: Mon, 24 May 2010 22:53:00 -0000	[thread overview]
Message-ID: <20100524225349.5670.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2010-05-24 22:53:49

Modified files:
	.              : WHATS_NEW 
	lib/device     : dev-cache.c 

Log message:
	Avoid selecting names under /dev/block if there is an alternative.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1596&r2=1.1597
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-cache.c.diff?cvsroot=lvm2&r1=1.56&r2=1.57

--- LVM2/WHATS_NEW	2010/05/24 17:46:47	1.1596
+++ LVM2/WHATS_NEW	2010/05/24 22:53:48	1.1597
@@ -1,5 +1,6 @@
 Version 2.02.67 -
 ===============================
+  Avoid selecting names under /dev/block if there is an alternative.
   Update clustered log kernel module name to log-userspace for 2.6.31 onwards.
   Activate only first head of Replicator for vgchange -ay.
   Add Replicators' LVs to dtree for activation.
--- LVM2/lib/device/dev-cache.c	2009/07/15 20:02:46	1.56
+++ LVM2/lib/device/dev-cache.c	2010/05/24 22:53:49	1.57
@@ -40,6 +40,7 @@
 	struct dm_hash_table *names;
 	struct btree *devices;
 	struct dm_regex *preferred_names_matcher;
+	const char *dev_dir;
 
 	int has_scanned;
 	struct dm_list dirs;
@@ -155,6 +156,7 @@
 	char p0[PATH_MAX], p1[PATH_MAX];
 	char *s0, *s1;
 	struct stat stat0, stat1;
+	size_t devdir_len;
 
 	/*
 	 * FIXME Better to compare patterns one-at-a-time against all names.
@@ -179,6 +181,19 @@
 	 * Built-in rules.
 	 */
 
+	/*
+	 * Anything beats /dev/block.
+	 */
+	devdir_len = strlen(_cache.dev_dir);
+	if (!strncmp(path0, _cache.dev_dir, devdir_len) &&
+	    !strncmp(path1, _cache.dev_dir, devdir_len)) {
+		if (!strncmp(path0 + devdir_len, "block/", 6)) {
+			if (strncmp(path1 + devdir_len, "block/", 6))
+				return 1;
+		} else if (!strncmp(path1 + devdir_len, "block/", 6))
+			return 0;
+	}
+
 	/* Return the path with fewer slashes */
 	for (p = path0; p++; p = (const char *) strchr(p, '/'))
 		slash0++;
@@ -545,6 +560,11 @@
 		goto bad;
 	}
 
+	if (!(_cache.dev_dir = _strdup(cmd->dev_dir))) {
+		log_error("strdup dev_dir failed.");
+		goto bad;
+	}
+
 	dm_list_init(&_cache.dirs);
 	dm_list_init(&_cache.files);
 


             reply	other threads:[~2010-05-24 22:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-24 22:53 agk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-04-11  9:12 prajnoha
2011-12-21 13:21 zkabelac
2011-12-21 13:17 zkabelac
2011-12-21 13:14 zkabelac
2011-01-17 15:16 zkabelac
2005-03-21 14:51 agk

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=20100524225349.5670.qmail@sourceware.org \
    --to=agk@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).