mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
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 <[email protected]> Signed-off-by: Neil Brown <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
242b363e22
commit
11e2ede022
1 file changed
+5
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user