All of lore.kernel.org
 help / color / mirror / Atom feed
From: wysochanski@sourceware.org <wysochanski@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 lib/metadata/metadata.c tools/pvcreate.c
Date: 26 Jul 2009 01:54:21 -0000	[thread overview]
Message-ID: <20090726015421.6053.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski at sourceware.org	2009-07-26 01:54:20

Modified files:
	lib/metadata   : metadata.c 
	tools          : pvcreate.c 

Log message:
	Move ORPHAN_VG lock outside pvcreate_single.
	
	The implicit pvcreate require either moving the ORPHAN_VG lock outside
	pvcreate_single or somehow having the function know or detect whether
	the ORPHAN_VG lock is already held.
	
	Author: Dave Wysochanski <dwysocha@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.264&r2=1.265
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvcreate.c.diff?cvsroot=lvm2&r1=1.82&r2=1.83

--- LVM2/lib/metadata/metadata.c	2009/07/26 01:53:57	1.264
+++ LVM2/lib/metadata/metadata.c	2009/07/26 01:54:20	1.265
@@ -1142,11 +1142,6 @@
 		}
 	}
 
-	if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE)) {
-		log_error("Can't get lock for orphan PVs");
-		return NULL;
-	}
-
 	if (!pvcreate_check(cmd, pv_name, pp))
 		goto error;
 
@@ -1203,11 +1198,9 @@
 
 	log_print("Physical volume \"%s\" successfully created", pv_name);
 
-	unlock_vg(cmd, VG_ORPHANS);
 	return pv;
 
       error:
-	unlock_vg(cmd, VG_ORPHANS);
 	return NULL;
 }
 
--- LVM2/tools/pvcreate.c	2009/07/26 01:53:09	1.82
+++ LVM2/tools/pvcreate.c	2009/07/26 01:54:20	1.83
@@ -171,9 +171,15 @@
 	}
 
 	for (i = 0; i < argc; i++) {
+		if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE)) {
+			log_error("Can't get lock for orphan PVs");
+			return ECMD_FAILED;
+		}
+
 		if (!pvcreate_single(cmd, argv[i], &pp))
 			ret = ECMD_FAILED;
 
+		unlock_vg(cmd, VG_ORPHANS);
 		if (sigint_caught())
 			return ret;
 	}



             reply	other threads:[~2009-07-26  1:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-26  1:54 wysochanski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-10-05 20:03 LVM2 lib/metadata/metadata.c tools/pvcreate.c 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=20090726015421.6053.qmail@sourceware.org \
    --to=wysochanski@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.