Commit 89078d57 authored by Martin K. Petersen's avatar Martin K. Petersen Committed by Linus Torvalds

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: default avatarGiacomo Catenazzi <cate@cateee.net>
Reported-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7de8e573
...@@ -1777,12 +1777,6 @@ int md_integrity_register(mddev_t *mddev) ...@@ -1777,12 +1777,6 @@ int md_integrity_register(mddev_t *mddev)
continue; continue;
if (rdev->raid_disk < 0) if (rdev->raid_disk < 0)
continue; 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) { if (!reference) {
/* Use the first rdev as the reference */ /* Use the first rdev as the reference */
reference = rdev; reference = rdev;
...@@ -1793,6 +1787,8 @@ int md_integrity_register(mddev_t *mddev) ...@@ -1793,6 +1787,8 @@ int md_integrity_register(mddev_t *mddev)
rdev->bdev->bd_disk) < 0) rdev->bdev->bd_disk) < 0)
return -EINVAL; return -EINVAL;
} }
if (!reference || !bdev_get_integrity(reference->bdev))
return 0;
/* /*
* All component devices are integrity capable and have matching * All component devices are integrity capable and have matching
* profiles, register the common profile for the md device. * profiles, register the common profile for the md device.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment