]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: fix first volume autolayout with IMSM_NO_PLATFORM
authorMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Thu, 23 May 2024 10:06:36 +0000 (12:06 +0200)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Tue, 28 May 2024 15:19:38 +0000 (17:19 +0200)
Autolayout_imsm() is not executed if IMSM_NO_PLATFORM=1 is set.
This causes that first volume cannot be created. Disk for new volume are
never configured.

Fix it by making autolayout_imsm() independent from super->orom because
NULL there means that IMSM_NO_PLATFORM=1 is set. There are not platform
restrictions to create volume, we just analyze drives. It is safe.

Fixes: 6d4d9ab295de ("imsm: use same slot across container")
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
super-intel.c

index 0287a6184047d5f139f8fe80dfa56002fca1fce5..29652196141b7d697ce0e2670d1be43395603235 100644 (file)
@@ -7706,9 +7706,11 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
                                  char *dev, unsigned long long *freesize,
                                  int consistency_policy, int verbose)
 {
-       int fd, cfd;
+       struct intel_super *super = st->sb;
        struct mdinfo *sra;
        int is_member = 0;
+       imsm_status_t rv;
+       int fd, cfd;
 
        /* load capability
         * if given unused devices create a container
@@ -7733,11 +7735,10 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
        }
 
        if (!dev) {
-               struct intel_super *super = st->sb;
-
                /*
                 * Autolayout mode, st->sb must be set.
                 */
+
                if (!super) {
                        pr_vrb("superblock must be set for autolayout, aborting\n");
                        return 0;
@@ -7749,20 +7750,19 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
                        return 0;
 
                if (super->orom && freesize) {
-                       imsm_status_t rv;
-                       int count = count_volumes(super->hba, super->orom->dpa,
-                                             verbose);
+                       int count = count_volumes(super->hba, super->orom->dpa, verbose);
+
                        if (super->orom->vphba <= count) {
                                pr_vrb("platform does not support more than %d raid volumes.\n",
                                       super->orom->vphba);
                                return 0;
                        }
+               }
 
-                       rv = autolayout_imsm(super, raiddisks, size, *chunk,
-                                            freesize);
+               rv = autolayout_imsm(super, raiddisks, size, *chunk, freesize);
                        if (rv != IMSM_STATUS_OK)
                                return 0;
-               }
+
                return 1;
        }
        if (st->sb) {