public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: mornfall@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW tools/pvcreate.c
Date: Wed, 09 Jan 2008 00:18:00 -0000	[thread overview]
Message-ID: <20080109001837.5131.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2008-01-09 00:18:37

Modified files:
	.              : WHATS_NEW 
	tools          : pvcreate.c 

Log message:
	Prevent pvcreate from overwriting MDA-less PVs belonging to active VGs.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.752&r2=1.753
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvcreate.c.diff?cvsroot=lvm2&r1=1.58&r2=1.59

--- LVM2/WHATS_NEW	2008/01/07 20:42:56	1.752
+++ LVM2/WHATS_NEW	2008/01/09 00:18:36	1.753
@@ -1,5 +1,6 @@
 Version 2.02.30 -
 ===================================
+  Prevent pvcreate from overwriting MDA-less PVs belonging to active VGs.
   Fix a segfault if using pvs with --all argument. (2.02.29)
   Update --uuid argument description in man pages.
   Fix vgreduce PV list processing not to process every PV in the VG. (2.02.29)
--- LVM2/tools/pvcreate.c	2007/11/22 01:25:06	1.58
+++ LVM2/tools/pvcreate.c	2008/01/09 00:18:36	1.59
@@ -14,6 +14,7 @@
  */
 
 #include "tools.h"
+#include "metadata.h"
 
 struct pvcreate_params {
 	int zero;
@@ -43,6 +44,17 @@
 	/* FIXME Use partial mode here? */
 	pv = pv_read(cmd, name, NULL, NULL, 0);
 
+	/*
+         * If a PV has no MDAs it may appear to be an orphan until the
+         * metadata is read off another PV in the same VG.  Detecting
+         * this means checking every VG by scanning every PV on the
+         * system.
+	 */
+	if (pv && is_orphan(pv)) {
+		(void) get_vgs(cmd, 1);
+		pv = pv_read(cmd, name, NULL, NULL, 0);
+	}
+
 	/* Allow partial & exported VGs to be destroyed. */
 	/* We must have -ff to overwrite a non orphan */
 	if (pv && !is_orphan(pv) && arg_count(cmd, force_ARG) != 2) {


             reply	other threads:[~2008-01-09  0:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-09  0:18 mornfall [this message]
2008-07-21 19:26 wysochanski

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=20080109001837.5131.qmail@sourceware.org \
    --to=mornfall@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).