summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2011-03-28 20:09:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-28 17:53:29 -0700
commit89078d572eb9ce8d4c04264b8b0ba86de0d74c8f (patch)
treed01104f97740c19daf01f49ae170df821a43252c
parent7de8e5737df31a6826015a65135ed8f0a32bb2c4 (diff)
downloadtalos-op-linux-89078d572eb9ce8d4c04264b8b0ba86de0d74c8f.tar.gz
talos-op-linux-89078d572eb9ce8d4c04264b8b0ba86de0d74c8f.zip
md: Fix integrity registration error when no devices are capable
We incorrectly returned -EINVAL when none of the devices in the array had an integrity profile. This in turn prevented mdadm from starting the metadevice. Fix this so we only return errors on mismatched profiles and memory allocation failures. Reported-by: Giacomo Catenazzi <cate@cateee.net> Reported-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/md/md.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 06ecea751a39..8b66e04c2ea6 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1777,12 +1777,6 @@ int md_integrity_register(mddev_t *mddev)
continue;
if (rdev->raid_disk < 0)
continue;
- /*
- * If at least one rdev is not integrity capable, we can not
- * enable data integrity for the md device.
- */
- if (!bdev_get_integrity(rdev->bdev))
- return -EINVAL;
if (!reference) {
/* Use the first rdev as the reference */
reference = rdev;
@@ -1793,6 +1787,8 @@ int md_integrity_register(mddev_t *mddev)
rdev->bdev->bd_disk) < 0)
return -EINVAL;
}
+ if (!reference || !bdev_get_integrity(reference->bdev))
+ return 0;
/*
* All component devices are integrity capable and have matching
* profiles, register the common profile for the md device.
OpenPOWER on IntegriCloud