MD: no integrity register if no gendisk
authorJonathan Brassow <jbrassow@f14.redhat.com>
Wed, 8 Jun 2011 05:10:08 +0000 (15:10 +1000)
committerNeilBrown <neilb@suse.de>
Wed, 8 Jun 2011 05:10:08 +0000 (15:10 +1000)
Don't attempt md_integrity_register if there is no gendisk struct available.

When MD arrays are built via device-mapper, the gendisk structure is not
available via mddev.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/md.c

index aa640a85bb2169aa14fb8d9875beb0ac9091192c..4ea02c634d33aead7c424c9ee7ac243093b3c681 100644 (file)
@@ -1781,8 +1781,8 @@ int md_integrity_register(mddev_t *mddev)
 
        if (list_empty(&mddev->disks))
                return 0; /* nothing to do */
-       if (blk_get_integrity(mddev->gendisk))
-               return 0; /* already registered */
+       if (!mddev->gendisk || blk_get_integrity(mddev->gendisk))
+               return 0; /* shouldn't register, or already is */
        list_for_each_entry(rdev, &mddev->disks, same_set) {
                /* skip spares and non-functional disks */
                if (test_bit(Faulty, &rdev->flags))