]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
IMSM metadata really should be ignored when found on partitions.
authorNeilBrown <neilb@suse.de>
Tue, 19 Nov 2013 23:49:14 +0000 (10:49 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 19 Nov 2013 23:49:14 +0000 (10:49 +1100)
commit b31df43682216d1c65813eae49ebdd8253db8907
changed load_super_imsm to not insist on finding a partition if
ignore_hw_compat was set.
Unfortunately this is set for '--assemble' so arrays could get
assembled badly.

The comment says this was to allow e.g. --examine of image files.
A better fixes for this is to change test_partitions to not report
a regular file as being a partition.
The errors from the BLKPG ioctl are:

 ENOTTY : not a block device.
 EINVAL : not a whole device (probably a partition)
 ENXIO  : partition doesn't exist (so not a partition)

Reported-by: "David F." <df7729@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
super-intel.c
util.c

index 7b24068664938162864c6f1677c41d291e53714f..c103ffdd2dd81e0aafdfb5031d30ad3e3fe4673a 100644 (file)
@@ -4423,7 +4423,7 @@ static int load_super_imsm(struct supertype *st, int fd, char *devname)
        struct intel_super *super;
        int rv;
 
-       if (!st->ignore_hw_compat && test_partition(fd))
+       if (test_partition(fd))
                /* IMSM not allowed on partitions */
                return 1;
 
diff --git a/util.c b/util.c
index 5f95f1f97c020c90916f6fc976b2a87133053bca..b29a3ee7ce4708e65da8abc6718a173b52986407 100644 (file)
--- a/util.c
+++ b/util.c
@@ -307,7 +307,7 @@ int test_partition(int fd)
        if (ioctl(fd, BLKPG, &a) == 0)
                /* Very unlikely, but not a partition */
                return 0;
-       if (errno == ENXIO)
+       if (errno == ENXIO || errno == ENOTTY)
                /* not a partition */
                return 0;