Skip to content

Commit

Permalink
md: Fix integrity registration error when no devices are capable
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reported-by: Thomas Gleixner <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
martinkpetersen authored and torvalds committed Mar 29, 2011
1 parent 7de8e57 commit 89078d5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
Expand Down

0 comments on commit 89078d5

Please sign in to comment.