summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2008-04-30 00:52:32 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 08:29:33 -0700
commit11e2ede0228ee0f81ccacd15894908c3bf241f73 (patch)
tree78bf7c8e2762d5dc07f2b9acb92ef5804ac40f38 /drivers/md
parent242b363e2207d14125f52a6701cfda7376a2a2fc (diff)
downloadblackbird-op-linux-11e2ede0228ee0f81ccacd15894908c3bf241f73.tar.gz
blackbird-op-linux-11e2ede0228ee0f81ccacd15894908c3bf241f73.zip
md: prevent duplicates in bind_rdev_to_array
Found when trying to reassemble an active externally managed array. Without this check we hit the more noisy "sysfs duplicate" warning in the later call to kobject_add. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 75a3f483522d..bec00b201a73 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1370,6 +1370,11 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
MD_BUG();
return -EINVAL;
}
+
+ /* prevent duplicates */
+ if (find_rdev(mddev, rdev->bdev->bd_dev))
+ return -EEXIST;
+
/* make sure rdev->size exceeds mddev->size */
if (rdev->size && (mddev->size == 0 || rdev->size < mddev->size)) {
if (mddev->pers) {
OpenPOWER on IntegriCloud