diff mbox series

[17/23] Assemble: check if device is container before scheduling force-clean update

Message ID 20220728122101.28744-18-colyli@suse.de (mailing list archive)
State Mainlined, archived
Delegated to: Jes Sorensen
Headers show
Series mdadm-CI for-jes/20220728: patches for merge | expand

Commit Message

Coly Li July 28, 2022, 12:20 p.m. UTC
From: Kinga Tanska <kinga.tanska@intel.com>

When assemble is used with --force flag and array is not clean then
"force-clean" update is scheduled. Containers are considered as not
clean because this field is not set for them. To exclude them from
meaningless update (it is ignored quietly) check if the device
is a container first.

Signed-off-by: Kinga Tanska <kinga.tanska@intel.com>
Acked-by: Coly Li <colyli@suse.de>
---
 Assemble.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/Assemble.c b/Assemble.c
index 6df6bfbc..1856b916 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -1809,10 +1809,9 @@  try_again:
 		}
 #endif
 	}
-	if (c->force && !clean &&
+	if (c->force && !clean && content->array.level != LEVEL_CONTAINER &&
 	    !enough(content->array.level, content->array.raid_disks,
-		    content->array.layout, clean,
-		    avail)) {
+		    content->array.layout, clean, avail)) {
 		change += st->ss->update_super(st, content, "force-array",
 					       devices[chosen_drive].devname, c->verbose,
 					       0, NULL);