1
0
Fork 0

Refreshing exit-gracefully-when-md-device-not-found.patch.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-14 06:02:01 +01:00
parent d0d9648c22
commit 27972f165d
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
3 changed files with 24 additions and 26 deletions

View file

@ -0,0 +1,23 @@
Author: Felix Lechner <felix.lechner@lease-up.com>
Description: Exit gracefully when md device not found (Closes: #970329).
diff -Naurp mdadm.orig/Monitor.c mdadm/Monitor.c
--- mdadm.orig/Monitor.c
+++ mdadm/Monitor.c
@@ -554,8 +554,14 @@ static int check_array(struct state *st,
if (fd < 0)
goto disappeared;
- if (st->devnm[0] == 0)
- snprintf(st->devnm, MD_NAME_MAX, "%s", fd2devnm(fd));
+ if (st->devnm[0] == 0) {
+ char *found = fd2devnm(fd);
+ if (!found) {
+ alert("DeviceDisappeared", dev, NULL, ainfo);
+ goto out;
+ }
+ snprintf(st->devnm, MD_NAME_MAX, "%s", found);
+ }
for (mse2 = mdstat; mse2; mse2 = mse2->next)
if (strcmp(mse2->devnm, st->devnm) == 0) {