All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] unblock the creation of an external metadata RAID if native one exists
@ 2011-01-25 15:23 Labun, Marcin
  0 siblings, 0 replies; only message in thread
From: Labun, Marcin @ 2011-01-25 15:23 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, Neubauer, Wojciech, Ciechanowski, Ed, Williams, Dan J

From aa169142c6dde0a7c1dc1b91dec0973474661036 Mon Sep 17 00:00:00 2001
From: Marcin Labun <marcin.labun@intel.com>
Date: Tue, 25 Jan 2011 15:57:20 +0100
Subject: [PATCH 1/1] md: unblock the creation of an external metadata RAID if native one exists

Native metadata reserves a parent disk device for exclusive use by setting
AllReserved in rdev->flags. Now if a member device has AllReserved flag set
on its block device then creation of any external metadata array/container on
is unreasonably blocked.
Solution:
When creating a new external RAID device we must check that the new
device is not using a partition of a disk, when there is another array
using another partition of the same disk calming exclusive usage for the
disk. Exclusive usage is enforced by setting AllReserved in rdev->flags.

Signed-off-by: Marcin Labun <marcin.labun@intel.com>
---
 drivers/md/md.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 175c424..1bb309f 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2603,15 +2603,30 @@ rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len)
 		mddev_unlock(my_mddev);
 		for_each_mddev(mddev, tmp) {
 			mdk_rdev_t *rdev2;
-
+			
 			mddev_lock(mddev);
+			 
 			list_for_each_entry(rdev2, &mddev->disks, same_set)
-				if (test_bit(AllReserved, &rdev2->flags) ||
+				if ((test_bit(AllReserved, &rdev2->flags) &&
+				     rdev->bdev->bd_contains == rdev2->bdev->bd_contains) ||
 				    (rdev->bdev == rdev2->bdev &&
 				     rdev != rdev2 &&
 				     overlaps(rdev->data_offset, rdev->sectors,
 					      rdev2->data_offset,
 					      rdev2->sectors))) {
+					char b[BDEVNAME_SIZE];
+
+					dprintk(KERN_INFO "rdev: %p %s\n", rdev, bdevname(rdev->bdev,b));
+					dprintk(KERN_INFO "rdev tested: %p %s\n", rdev2, bdevname(rdev2->bdev,b));
+					dprintk(KERN_INFO "my_mddev: %p tested: %p if: %d, %d, %d, %d, %d \n",
+						my_mddev,
+						mddev,
+						test_bit(AllReserved, &rdev2->flags),
+						rdev->bdev->bd_contains == rdev2->bdev->bd_contains,
+						rdev->bdev == rdev2->bdev,
+						rdev != rdev2,
+						overlaps(rdev->data_offset, rdev->sectors,
+							 rdev2->data_offset,  rdev2->sectors));
 					overlap = 1;
 					break;
 				}
-- 
1.6.4.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-01-25 15:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-25 15:23 [PATCH 1/1] unblock the creation of an external metadata RAID if native one exists Labun, Marcin

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.