From 70f1ff4291b0388adca1f4c91918ce1175e8b360 Mon Sep 17 00:00:00 2001 From: Lukasz Florczak Date: Wed, 15 Jun 2022 14:28:39 +0200 Subject: mdadm: block update=ppl for non raid456 levels Option ppl should be used only for raid levels 4, 5 and 6. Cancel update for other levels. Applied globally for imsm and ddf format. Additionally introduce is_level456() helper function. Signed-off-by: Lukasz Florczak Signed-off-by: Jes Sorensen --- Assemble.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'Assemble.c') diff --git a/Assemble.c b/Assemble.c index 4b213560..6df6bfbc 100644 --- a/Assemble.c +++ b/Assemble.c @@ -906,8 +906,7 @@ static int force_array(struct mdinfo *content, * devices in RAID4 or last devices in RAID4/5/6. */ delta = devices[j].i.delta_disks; - if (devices[j].i.array.level >= 4 && - devices[j].i.array.level <= 6 && + if (is_level456(devices[j].i.array.level) && i/2 >= content->array.raid_disks - delta) /* OK */; else if (devices[j].i.array.level == 4 && @@ -1226,8 +1225,7 @@ static int start_array(int mdfd, fprintf(stderr, ".\n"); } if (content->reshape_active && - content->array.level >= 4 && - content->array.level <= 6) { + is_level456(content->array.level)) { /* might need to increase the size * of the stripe cache - default is 256 */ @@ -1974,7 +1972,8 @@ int assemble_container_content(struct supertype *st, int mdfd, int start_reshape; char *avail; int err; - int is_raid456, is_clean, all_disks; + int is_clean, all_disks; + bool is_raid456; if (sysfs_init(content, mdfd, NULL)) { pr_err("Unable to initialize sysfs\n"); @@ -2107,7 +2106,7 @@ int assemble_container_content(struct supertype *st, int mdfd, content->array.state |= 1; } - is_raid456 = (content->array.level >= 4 && content->array.level <= 6); + is_raid456 = is_level456(content->array.level); is_clean = content->array.state & 1; if (enough(content->array.level, content->array.raid_disks, -- cgit v1.2.3