]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: block using partition
authorMariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Fri, 28 Sep 2018 07:48:53 +0000 (09:48 +0200)
committerJes Sorensen <jsorensen@fb.com>
Fri, 28 Sep 2018 14:25:58 +0000 (10:25 -0400)
When IMSM_NO_PLATFORM is exported mdadm allows to create array with
partitions or add partition to existing array but there is no
possibilty to assemble it after stopping, see commit 691c6ee1b6bb
("IMSM/DDF: don't recognised these metadata on partitions.").

When searching for hba capabilities first test device and print
corresponding error if it is a partition.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
super-intel.c

index d3d256a4f36b0ba6199be7e70454ed1ce2574e10..6438987b778c43f3d9c2ce9df86128c58b03ba2d 100644 (file)
@@ -4523,6 +4523,11 @@ static int find_intel_hba_capability(int fd, struct intel_super *super, char *de
        struct sys_dev *hba_name;
        int rv = 0;
 
+       if (fd >= 0 && test_partition(fd)) {
+               pr_err("imsm: %s is a partition, cannot be used in IMSM\n",
+                      devname);
+               return 1;
+       }
        if (fd < 0 || check_env("IMSM_NO_PLATFORM")) {
                super->orom = NULL;
                super->hba = NULL;