mdadm/0081-Assemble.c-respect-force-flag.patch
Neil Brown 505f19f50d Accepting request 841255 from home:colyli:branches:Base:System
- Update to latest mdadm which is requested by jsc#SLE-13700 from
  partners. Mostly the purpose is for latest Intel IMSM raid
  support, while some other fixes are important too.
- imsm: Correct minimal device size (jsc#SLE-13700)
  0073-imsm-Correct-minimal-device-size.patch
- Detail: show correct bitmap info for cluster raid device
  (jsc#SLE-13700)
  0074-Detail-show-correct-bitmap-info-for-cluster-raid-dev.patch
- imsm: support the Array Creation Time field in metadata
  (jsc#SLE-13700)
  0075-imsm-support-the-Array-Creation-Time-field-in-metada.patch
- imsm: show Subarray and Volume ID in --examine output
  (jsc#SLE-13700)
  0076-imsm-show-Subarray-and-Volume-ID-in-examine-output.patch
- udev: Ignore change event for imsm (jsc#SLE-13700)
  0077-udev-Ignore-change-event-for-imsm.patch
- Manage, imsm: Write metadata before add (jsc#SLE-13700)
  0078-Manage-imsm-Write-metadata-before-add.patch
- Assemble: print error message if mdadm fails assembling
  with --uuid option (jsc#SLE-13700)
  0079-Assemble-print-error-message-if-mdadm-fails-assembli.patch
- clean up meaning of small typo (jsc#SLE-13700)
  0080-clean-up-meaning-of-small-typo.patch
- Assemble.c: respect force flag (jsc#SLE-13700)
  0081-Assemble.c-respect-force-flag.patch
- mdcheck: Log when done (jsc#SLE-13700)
  0082-mdcheck-Log-when-done.patch
- Makefile: add EXTRAVERSION support (jsc#SLE-13700)
  0083-Makefile-add-EXTRAVERSION-support.patch
- uuid.c: split uuid stuffs from util.c (jsc#SLE-13700)

OBS-URL: https://build.opensuse.org/request/show/841255
OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=189
2020-10-15 23:45:51 +00:00

100 lines
3.3 KiB
Diff

From 7b99edab2834d5d08ef774b4cff784caaa1a186f Mon Sep 17 00:00:00 2001
From: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Date: Tue, 5 May 2020 12:17:17 +0200
Subject: [PATCH 76/89] Assemble.c: respect force flag.
Git-commit: 7b99edab2834d5d08ef774b4cff784caaa1a186f
Patch-mainline: mdadm-4.1+
References: jsc#SLE-13700
If the array is dirty handler will set resync_start to 0 to inform kernel
that resync is needed. RWH affects only raid456 module, for other
levels array will be started even array is degraded and resync cannot be
performed.
Force is really meaningful for raid456. If array is degraded and resync
is requested, kernel will reject an attempt to start the array. To
respect force, it has to be marked as clean (this will be done for each
array without PPL) and remove the resync request (only for raid 456).
Data corruption may occur so proper warning is added.
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Signed-off-by: Coly Li <colyli@suse.de>
---
Assemble.c | 51 ++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 38 insertions(+), 13 deletions(-)
diff --git a/Assemble.c b/Assemble.c
index 2ed5884..3e5d4e6 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -2030,6 +2030,15 @@ int assemble_container_content(struct supertype *st, int mdfd,
free(avail);
return err;
}
+ } else if (c->force) {
+ /* Set the array as 'clean' so that we can proceed with starting
+ * it even if we don't have all devices. Mdmon doesn't care
+ * if the dirty flag is set in metadata, it will start managing
+ * it anyway.
+ * This is really important for raid456 (RWH case), other levels
+ * are started anyway.
+ */
+ content->array.state |= 1;
}
if (enough(content->array.level, content->array.raid_disks,
@@ -2049,20 +2058,36 @@ int assemble_container_content(struct supertype *st, int mdfd,
}
free(avail);
- if (c->runstop <= 0 &&
- (working + preexist + expansion) <
- content->array.working_disks) {
- if (c->export && result)
- *result |= INCR_UNSAFE;
- else if (c->verbose >= 0) {
- pr_err("%s assembled with %d device%s",
- chosen_name, preexist + working,
- preexist + working == 1 ? "":"s");
- if (preexist)
- fprintf(stderr, " (%d new)", working);
- fprintf(stderr, " but not safe to start\n");
+ if ((working + preexist + expansion) < content->array.working_disks) {
+ if (c->runstop <= 0) {
+ if (c->export && result)
+ *result |= INCR_UNSAFE;
+ else if (c->verbose >= 0) {
+ pr_err("%s assembled with %d device%s",
+ chosen_name, preexist + working,
+ preexist + working == 1 ? "":"s");
+ if (preexist)
+ fprintf(stderr, " (%d new)", working);
+ fprintf(stderr, " but not safe to start\n");
+ if (c->force)
+ pr_err("Consider --run to start array as degraded.\n");
+ }
+ return 1;
+ } else if (content->array.level >= 4 &&
+ content->array.level <= 6 &&
+ content->resync_start != MaxSector &&
+ c->force) {
+ /* Don't inform the kernel that the array is not
+ * clean and requires resync.
+ */
+ content->resync_start = MaxSector;
+ err = sysfs_set_num(content, NULL, "resync_start",
+ MaxSector);
+ if (err)
+ return 1;
+ pr_err("%s array state forced to clean. It may cause data corruption.\n",
+ chosen_name);
}
- return 1;
}
--
2.26.2