All of lore.kernel.org
 help / color / mirror / Atom feed
From: mbroz@sourceware.org <mbroz@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 ./WHATS_NEW test/t-pv-range-overflow.sh t ...
Date: 4 Apr 2008 11:59:33 -0000	[thread overview]
Message-ID: <20080404115933.31080.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz at sourceware.org	2008-04-04 11:59:32

Modified files:
	.              : WHATS_NEW 
	test           : t-pv-range-overflow.sh 
	tools          : pvmove.c 

Log message:
	Add validation of LV name to pvmove -n.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.823&r2=1.824
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-pv-range-overflow.sh.diff?cvsroot=lvm2&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.48&r2=1.49

--- LVM2/WHATS_NEW	2008/04/04 08:53:46	1.823
+++ LVM2/WHATS_NEW	2008/04/04 11:59:29	1.824
@@ -1,5 +1,6 @@
 Version 2.02.34 -
 ===================================
+  Add validation of LV name to pvmove -n.
   Make clvmd refresh the context correctly when lvm.conf is updated.
   Add some basic internal VG lock validation.
   Add per-command flags to control which commands use the VG metadata cache.
--- LVM2/test/t-pv-range-overflow.sh	2007/09/24 19:19:18	1.2
+++ LVM2/test/t-pv-range-overflow.sh	2008/04/04 11:59:30	1.3
@@ -37,14 +37,13 @@
    lvcreate -L4 -n"$lv" "$vg"'
 
 # Test for the bogus diagnostic reported in BZ 284771
-# http://bugzilla.redhat.com/284771.  Once the BZ is fixed,
-# update the code below to expect an improved diagnostic.
+# http://bugzilla.redhat.com/284771.
 test_expect_success \
   'run pvmove with an unrecognized LV name to show bad diagnostic' \
   'pvmove -v -nbogus $d1 $d2 2> err
    test $? = 5 &&
    tail -n1 err > out &&
-   echo "  No data to move for $vg" > expected &&
+   echo "  Logical volume bogus not found." > expected &&
    diff -u out expected'
 
 # With lvm-2.02.28 and earlier, on a system with 64-bit "long int",
--- LVM2/tools/pvmove.c	2008/01/30 14:00:02	1.48
+++ LVM2/tools/pvmove.c	2008/04/04 11:59:31	1.49
@@ -147,6 +147,7 @@
 	struct logical_volume *lv_mirr, *lv;
 	struct lv_list *lvl;
 	uint32_t log_count = 0;
+	int lv_found = 0;
 
 	/* FIXME Cope with non-contiguous => splitting existing segments */
 	if (!(lv_mirr = lv_create_empty("pvmove%d", NULL,
@@ -168,9 +169,13 @@
 	/* Find segments to be moved and set up mirrors */
 	list_iterate_items(lvl, &vg->lvs) {
 		lv = lvl->lv;
-		if ((lv == lv_mirr) ||
-		    (lv_name && strcmp(lv->name, lv_name)))
+		if ((lv == lv_mirr))
 			continue;
+		if (lv_name) {
+			if (strcmp(lv->name, lv_name))
+				continue;
+			lv_found = 1;
+		}
 		if (lv_is_origin(lv) || lv_is_cow(lv)) {
 			log_print("Skipping snapshot-related LV %s", lv->name);
 			continue;
@@ -196,6 +201,11 @@
 			return_NULL;
 	}
 
+	if (lv_name && !lv_found) {
+		log_error("Logical volume %s not found.", lv_name);
+		return NULL;
+	}
+
 	/* Is temporary mirror empty? */
 	if (!lv_mirr->le_count) {
 		log_error("No data to move for %s", vg->name);
@@ -310,6 +320,11 @@
 			stack;
 			return EINVALID_CMD_LINE;
 		}
+
+		if (!validate_name(lv_name)) {
+			log_error("Logical volume name %s is invalid", lv_name);
+			return EINVALID_CMD_LINE;
+		}
 	}
 
 	/* Read VG */



                 reply	other threads:[~2008-04-04 11:59 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=20080404115933.31080.qmail@sourceware.org \
    --to=mbroz@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.