Accepting request 1040907 from Base:System
OBS-URL: https://build.opensuse.org/request/show/1040907 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mdadm?expand=0&rev=138
This commit is contained in:
commit
61e6f4e362
@ -1,94 +0,0 @@
|
|||||||
From fc6fd4063769f4194c3fb8f77b32b2819e140fb9 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mateusz Kusiak <mateusz.kusiak@intel.com>
|
|
||||||
Date: Thu, 18 Aug 2022 11:47:21 +0200
|
|
||||||
Subject: [PATCH 55/61] Manage: Block unsafe member failing
|
|
||||||
Patch-mainline: mdadm-4.2+
|
|
||||||
References: jsc#PED-1009
|
|
||||||
|
|
||||||
Kernel may or may not block mdadm from removing member device if it
|
|
||||||
will cause arrays failed state. It depends on raid personality
|
|
||||||
implementation in kernel.
|
|
||||||
Add verification on requested removal path (#mdadm --set-faulty
|
|
||||||
command).
|
|
||||||
|
|
||||||
Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
|
|
||||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
||||||
Signed-off-by: Coly Li <colyli@suse.de>
|
|
||||||
---
|
|
||||||
Manage.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
|
||||||
1 file changed, 52 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/Manage.c b/Manage.c
|
|
||||||
index a142f8b..b1d0e63 100644
|
|
||||||
--- a/Manage.c
|
|
||||||
+++ b/Manage.c
|
|
||||||
@@ -1285,6 +1285,50 @@ int Manage_with(struct supertype *tst, int fd, struct mddev_dev *dv,
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/**
|
|
||||||
+ * is_remove_safe() - Check if remove is safe.
|
|
||||||
+ * @array: Array info.
|
|
||||||
+ * @fd: Array file descriptor.
|
|
||||||
+ * @devname: Name of device to remove.
|
|
||||||
+ * @verbose: Verbose.
|
|
||||||
+ *
|
|
||||||
+ * The function determines if array will be operational
|
|
||||||
+ * after removing &devname.
|
|
||||||
+ *
|
|
||||||
+ * Return: True if array will be operational, false otherwise.
|
|
||||||
+ */
|
|
||||||
+bool is_remove_safe(mdu_array_info_t *array, const int fd, char *devname, const int verbose)
|
|
||||||
+{
|
|
||||||
+ dev_t devid = devnm2devid(devname + 5);
|
|
||||||
+ struct mdinfo *mdi = sysfs_read(fd, NULL, GET_DEVS | GET_DISKS | GET_STATE);
|
|
||||||
+
|
|
||||||
+ if (!mdi) {
|
|
||||||
+ if (verbose)
|
|
||||||
+ pr_err("Failed to read sysfs attributes for %s\n", devname);
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ char *avail = xcalloc(array->raid_disks, sizeof(char));
|
|
||||||
+
|
|
||||||
+ for (mdi = mdi->devs; mdi; mdi = mdi->next) {
|
|
||||||
+ if (mdi->disk.raid_disk < 0)
|
|
||||||
+ continue;
|
|
||||||
+ if (!(mdi->disk.state & (1 << MD_DISK_SYNC)))
|
|
||||||
+ continue;
|
|
||||||
+ if (makedev(mdi->disk.major, mdi->disk.minor) == devid)
|
|
||||||
+ continue;
|
|
||||||
+ avail[mdi->disk.raid_disk] = 1;
|
|
||||||
+ }
|
|
||||||
+ sysfs_free(mdi);
|
|
||||||
+
|
|
||||||
+ bool is_enough = enough(array->level, array->raid_disks,
|
|
||||||
+ array->layout, (array->state & 1),
|
|
||||||
+ avail);
|
|
||||||
+
|
|
||||||
+ free(avail);
|
|
||||||
+ return is_enough;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
int Manage_subdevs(char *devname, int fd,
|
|
||||||
struct mddev_dev *devlist, int verbose, int test,
|
|
||||||
char *update, int force)
|
|
||||||
@@ -1598,7 +1642,14 @@ int Manage_subdevs(char *devname, int fd,
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'f': /* set faulty */
|
|
||||||
- /* FIXME check current member */
|
|
||||||
+ if (!is_remove_safe(&array, fd, dv->devname, verbose)) {
|
|
||||||
+ pr_err("Cannot remove %s from %s, array will be failed.\n",
|
|
||||||
+ dv->devname, devname);
|
|
||||||
+ if (sysfd >= 0)
|
|
||||||
+ close(sysfd);
|
|
||||||
+ goto abort;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if ((sysfd >= 0 && write(sysfd, "faulty", 6) != 6) ||
|
|
||||||
(sysfd < 0 && ioctl(fd, SET_DISK_FAULTY,
|
|
||||||
rdev))) {
|
|
||||||
--
|
|
||||||
2.35.3
|
|
||||||
|
|
@ -1,3 +1,13 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Dec 7 08:42:17 UTC 2022 - Coly Li <colyli@suse.com>
|
||||||
|
|
||||||
|
- Drop the patch which is reported as regression by upstream developer
|
||||||
|
(bsc#1206139)
|
||||||
|
0045-Manage-Block-unsafe-member-failing.patch
|
||||||
|
- Add jsc#PED-947 together with jsc#PED-1009 in mdadm.changes, they
|
||||||
|
are both the requirement to update mdadm to latest upstream state
|
||||||
|
via different requestors.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Nov 24 06:23:28 UTC 2022 - Coly Li <colyli@suse.com>
|
Thu Nov 24 06:23:28 UTC 2022 - Coly Li <colyli@suse.com>
|
||||||
|
|
||||||
@ -17,7 +27,7 @@ Thu Nov 24 05:57:50 UTC 2022 - Coly Li <colyli@suse.com>
|
|||||||
Thu Nov 3 15:58:38 UTC 2022 - Coly Li <colyli@suse.com>
|
Thu Nov 3 15:58:38 UTC 2022 - Coly Li <colyli@suse.com>
|
||||||
|
|
||||||
- Update mdadm package to latest mdadm since mdadm-4.2
|
- Update mdadm package to latest mdadm since mdadm-4.2
|
||||||
(jsc#PED-1009)
|
(jsc#PED-1009, jsc#PED-947)
|
||||||
* Only patches directly change runtime programs included,
|
* Only patches directly change runtime programs included,
|
||||||
- Unify error message.
|
- Unify error message.
|
||||||
0001-Unify-error-message.patch
|
0001-Unify-error-message.patch
|
||||||
@ -129,7 +139,7 @@ Thu Nov 3 15:58:38 UTC 2022 - Coly Li <colyli@suse.com>
|
|||||||
- Rename 0000-Makefile-install-mdadm_env.sh-to-usr-lib-mdadm.patch
|
- Rename 0000-Makefile-install-mdadm_env.sh-to-usr-lib-mdadm.patch
|
||||||
to 1004-Makefile-install-mdadm_env.sh-to-usr-lib-mdadm.patch.
|
to 1004-Makefile-install-mdadm_env.sh-to-usr-lib-mdadm.patch.
|
||||||
|
|
||||||
- Update mdadm package to mdadm-4.2 (jsc#PED-1009)
|
- Update mdadm package to mdadm-4.2 (jsc#PED-1009, jsc#PED-947)
|
||||||
All important modifications since previous update to mdadm-4.2
|
All important modifications since previous update to mdadm-4.2
|
||||||
are listed here.
|
are listed here.
|
||||||
* The patches about Intel Matrix Storage Manager (including
|
* The patches about Intel Matrix Storage Manager (including
|
||||||
|
@ -86,7 +86,6 @@ Patch41: 0041-Grow-Split-Grow_reshape-into-helper-function.patch
|
|||||||
Patch42: 0042-Assemble-check-if-device-is-container-before-schedul.patch
|
Patch42: 0042-Assemble-check-if-device-is-container-before-schedul.patch
|
||||||
Patch43: 0043-super1-report-truncated-device.patch
|
Patch43: 0043-super1-report-truncated-device.patch
|
||||||
Patch44: 0044-mdadm-Correct-typos-punctuation-and-grammar-in-man.patch
|
Patch44: 0044-mdadm-Correct-typos-punctuation-and-grammar-in-man.patch
|
||||||
Patch45: 0045-Manage-Block-unsafe-member-failing.patch
|
|
||||||
Patch46: 0046-Monitor-Fix-statelist-memory-leaks.patch
|
Patch46: 0046-Monitor-Fix-statelist-memory-leaks.patch
|
||||||
Patch47: 0047-mdadm-added-support-for-Intel-Alderlake-RST-on-VMD-p.patch
|
Patch47: 0047-mdadm-added-support-for-Intel-Alderlake-RST-on-VMD-p.patch
|
||||||
Patch48: 0048-mdadm-Add-Documentation-entries-to-systemd-services.patch
|
Patch48: 0048-mdadm-Add-Documentation-entries-to-systemd-services.patch
|
||||||
@ -150,7 +149,6 @@ mdadm is a program that can be used to control Linux md devices.
|
|||||||
%patch42 -p1
|
%patch42 -p1
|
||||||
%patch43 -p1
|
%patch43 -p1
|
||||||
%patch44 -p1
|
%patch44 -p1
|
||||||
%patch45 -p1
|
|
||||||
%patch46 -p1
|
%patch46 -p1
|
||||||
%patch47 -p1
|
%patch47 -p1
|
||||||
%patch48 -p1
|
%patch48 -p1
|
||||||
|
Loading…
Reference in New Issue
Block a user