From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 003 of 6] md: Move warning about creating a raid array on partitions of the one device.
Date: Tue, 20 Feb 2007 17:35:00 +1100 [thread overview]
Message-ID: <1070220063500.16163@suse.de> (raw)
In-Reply-To: 20070220172544.15678.patches@notabene
md tries to warn the user if they e.g. create a raid1 using two partitions
of the same device, as this does not provide true redundancy.
However it also warns if a raid0 is created like this, and there is
nothing wrong with that.
At the place where the warning is currently printer, we don't necessarily
know what level the array will be, so move the warning from the point
where the device is added to the point where the array is started.
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./drivers/md/md.c | 63 +++++++++++++++++++++++++++++++-----------------------
1 file changed, 37 insertions(+), 26 deletions(-)
diff .prev/drivers/md/md.c ./drivers/md/md.c
--- .prev/drivers/md/md.c 2007-02-20 17:10:06.000000000 +1100
+++ ./drivers/md/md.c 2007-02-20 17:12:16.000000000 +1100
@@ -1296,27 +1296,17 @@ static struct super_type super_types[] =
.sync_super = super_1_sync,
},
};
-
-static mdk_rdev_t * match_dev_unit(mddev_t *mddev, mdk_rdev_t *dev)
-{
- struct list_head *tmp;
- mdk_rdev_t *rdev;
-
- ITERATE_RDEV(mddev,rdev,tmp)
- if (rdev->bdev->bd_contains == dev->bdev->bd_contains)
- return rdev;
-
- return NULL;
-}
static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2)
{
- struct list_head *tmp;
- mdk_rdev_t *rdev;
+ struct list_head *tmp, *tmp2;
+ mdk_rdev_t *rdev, *rdev2;
ITERATE_RDEV(mddev1,rdev,tmp)
- if (match_dev_unit(mddev2, rdev))
- return 1;
+ ITERATE_RDEV(mddev2, rdev2, tmp2)
+ if (rdev->bdev->bd_contains ==
+ rdev2->bdev->bd_contains)
+ return 1;
return 0;
}
@@ -1325,8 +1315,7 @@ static LIST_HEAD(pending_raid_disks);
static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
{
- mdk_rdev_t *same_pdev;
- char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE];
+ char b[BDEVNAME_SIZE];
struct kobject *ko;
char *s;
@@ -1342,14 +1331,6 @@ static int bind_rdev_to_array(mdk_rdev_t
else
mddev->size = rdev->size;
}
- same_pdev = match_dev_unit(mddev, rdev);
- if (same_pdev)
- printk(KERN_WARNING
- "%s: WARNING: %s appears to be on the same physical"
- " disk as %s. True\n protection against single-disk"
- " failure might be compromised.\n",
- mdname(mddev), bdevname(rdev->bdev,b),
- bdevname(same_pdev->bdev,b2));
/* Verify rdev->desc_nr is unique.
* If it is -1, assign a free number, else
@@ -3109,6 +3090,36 @@ static int do_md_run(mddev_t * mddev)
return -EINVAL;
}
+ if (pers->sync_request) {
+ /* Warn if this is a potentially silly
+ * configuration.
+ */
+ char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE];
+ mdk_rdev_t *rdev2;
+ struct list_head *tmp2;
+ int warned = 0;
+ ITERATE_RDEV(mddev, rdev, tmp) {
+ ITERATE_RDEV(mddev, rdev2, tmp2) {
+ if (rdev < rdev2 &&
+ rdev->bdev->bd_contains ==
+ rdev2->bdev->bd_contains) {
+ printk(KERN_WARNING
+ "%s: WARNING: %s appears to be"
+ " on the same physical disk as"
+ " %s.\n",
+ mdname(mddev),
+ bdevname(rdev->bdev,b),
+ bdevname(rdev2->bdev,b2));
+ warned = 1;
+ }
+ }
+ }
+ if (warned)
+ printk(KERN_WARNING
+ "True protection against single-disk"
+ " failure might be compromised.\n");
+ }
+
mddev->recovery = 0;
mddev->resync_max_sectors = mddev->size << 1; /* may be over-ridden by personality */
mddev->barriers_work = 1;
next prev parent reply other threads:[~2007-02-20 6:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-20 6:34 [PATCH 000 of 6] md: Assorted fixes and features for md for 2.6.21 NeilBrown
2007-02-20 6:34 ` [PATCH 001 of 6] md: Fix raid10 recovery problem NeilBrown
2007-02-20 6:34 ` [PATCH 002 of 6] md: RAID6: clean up CPUID and FPU enter/exit code NeilBrown
2007-02-20 6:35 ` NeilBrown [this message]
2007-02-20 6:35 ` [PATCH 004 of 6] md: Clean out unplug and other queue function on md shutdown NeilBrown
2007-02-20 6:35 ` [PATCH 005 of 6] md: Restart a (raid5) reshape that has been aborted due to a read/write error NeilBrown
2007-02-20 6:35 ` [PATCH 006 of 6] md: Add support for reshape of a raid6 NeilBrown
2007-02-21 22:48 ` Andrew Morton
2007-02-21 23:36 ` Oleg Verych
2007-02-21 23:58 ` Andrew Morton
2007-02-21 23:57 ` Rafael J. Wysocki
2007-02-22 2:39 ` Neil Brown
2007-02-22 2:57 ` Andrew Morton
2007-02-23 12:15 ` Helge Hafting
2007-02-23 15:52 ` Bill Davidsen
2007-02-20 23:22 ` [PATCH 000 of 6] md: Assorted fixes and features for md for 2.6.21 Bill Davidsen
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=1070220063500.16163@suse.de \
--to=neilb@suse.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.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 NNTP newsgroup(s).