Hello community,

here is the log from the commit of package mdadm for openSUSE:Factory checked 
in at 2020-06-26 21:45:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/mdadm (Old)
 and      /work/SRC/openSUSE:Factory/.mdadm.new.3060 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "mdadm"

Fri Jun 26 21:45:28 2020 rev:122 rq:816923 version:4.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/mdadm/mdadm.changes      2020-03-31 
17:31:51.988247175 +0200
+++ /work/SRC/openSUSE:Factory/.mdadm.new.3060/mdadm.changes    2020-06-26 
21:46:14.341983868 +0200
@@ -1,0 +2,16 @@
+Mon Jun 22 16:12:47 UTC 2020 - Coly Li <[email protected]>
+
+- OnCalendar format fix of mdcheck_start.timer (bsc#1173137)
+  1002-OnCalendar-format-fix-of-mdcheck_start-timer.patch
+
+-------------------------------------------------------------------
+Mon Jun 22 15:33:44 UTC 2020 - Coly Li <[email protected]>
+
+- Detail: adding sync status for cluster device
+  (bsc#1163727)
+  0072-Detail-adding-sync-status-for-cluster-device.patch
+- Monitor: improve check_one_sharer() for checking duplicated process
+  (bsc#1168953)
+  0071-Monitor-improve-check_one_sharer-for-checking-duplic.patch
+
+-------------------------------------------------------------------

New:
----
  0071-Monitor-improve-check_one_sharer-for-checking-duplic.patch
  0072-Detail-adding-sync-status-for-cluster-device.patch
  1002-OnCalendar-format-fix-of-mdcheck_start-timer.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ mdadm.spec ++++++
--- /var/tmp/diff_new_pack.KaadMa/_old  2020-06-26 21:46:16.785991691 +0200
+++ /var/tmp/diff_new_pack.KaadMa/_new  2020-06-26 21:46:16.789991703 +0200
@@ -107,7 +107,10 @@
 Patch63:        0068-Remove-the-legacy-whitespace.patch
 Patch64:        0069-imsm-pass-subarray-id-to-kill_subarray-function.patch
 Patch65:        0070-imsm-Remove-dump-restore-implementation.patch
+Patch66:        0071-Monitor-improve-check_one_sharer-for-checking-duplic.patch
+Patch67:        0072-Detail-adding-sync-status-for-cluster-device.patch
 Patch1001:      1001-display-timeout-status.patch
+Patch1002:      1002-OnCalendar-format-fix-of-mdcheck_start-timer.patch
 %define _udevdir %(pkg-config --variable=udevdir udev)
 %define _systemdshutdowndir %{_unitdir}/../system-shutdown
 
@@ -182,7 +185,10 @@
 %patch63 -p1
 %patch64 -p1
 %patch65 -p1
+%patch66 -p1
+%patch67 -p1
 %patch1001 -p1
+%patch1002 -p1
 
 %build
 make %{?_smp_mflags} CC="%__cc" CXFLAGS="%{optflags} -Wno-error" SUSE=yes

++++++ 0071-Monitor-improve-check_one_sharer-for-checking-duplic.patch ++++++
>From 185ec4397e61ad00dd68c841e15eaa8629eb9514 Mon Sep 17 00:00:00 2001
From: Coly Li <[email protected]>
Date: Sat, 11 Apr 2020 00:24:46 +0800
Subject: [PATCH] Monitor: improve check_one_sharer() for checking duplicated
 process
Git-commit: 185ec4397e61ad00dd68c841e15eaa8629eb9514
Patch-mainline: mdadm-4.1+
References: bsc#1168953

When running mdadm monitor with scan mode, only one autorebuild process
is allowed. check_one_sharer() checks duplicated process by following
steps,
1) Read autorebuild.pid file,
   - if file does not exist, no duplicated process, go to 3).
   - if file exists, continue to next step.
2) Read pid number from autorebuild.pid file, then check procfs pid
   directory /proc/<PID>,
   - if the directory does not exist, no duplicated process, go to 3)
   - if the directory exists, print error message for duplicated process
     and exit this mdadm.
3) Write current pid into autorebuild.pid file, continue to monitor in
   scan mode.

The problem for the above step 2) is, if after system reboots and
another different process happens to have exact same pid number which
autorebuild.pid file records, check_one_sharer() will treat it as a
duplicated mdadm process and returns error with message "Only one
autorebuild process allowed in scan mode, aborting".

This patch tries to fix the above same-pid-but-different-process issue
by one more step to check the process command name,
1) Read autorebuild.pid file
   - if file does not exist, no duplicated process, go to 4).
   - if file exists, continue to next step.
2) Read pid number from autorebuild.pid file, then check procfs file
   comm with the specific pid directory /proc/<PID>/comm
   - if the file does not exit, it means the directory /proc/<PID> does
     not exist, go to 4)
   - if the file exits, continue next step
3) Read process command name from /proc/<PIC>/comm, compare the command
   name with "mdadm" process name,
   - if not equal, no duplicated process, goto 4)
   - if strings are equal, print error message for duplicated process
     and exit this mdadm.
4) Write current pid into autorebuild.pid file, continue to monitor in
   scan mode.

Now check_one_sharer() returns error for duplicated process only when
the recorded pid from autorebuild.pid exists, and the process has exact
same command name as "mdadm".

Reported-by: Shinkichi Yamazaki <[email protected]>
Signed-off-by: Coly Li <[email protected]>
Signed-off-by: Jes Sorensen <[email protected]>
---
 Monitor.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/Monitor.c b/Monitor.c
index b527165..2d6b3b9 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -301,26 +301,34 @@ static int make_daemon(char *pidfile)
 
 static int check_one_sharer(int scan)
 {
-       int pid, rv;
+       int pid;
+       FILE *comm_fp;
        FILE *fp;
-       char dir[20];
+       char comm_path[100];
        char path[100];
-       struct stat buf;
+       char comm[20];
+
        sprintf(path, "%s/autorebuild.pid", MDMON_DIR);
        fp = fopen(path, "r");
        if (fp) {
                if (fscanf(fp, "%d", &pid) != 1)
                        pid = -1;
-               sprintf(dir, "/proc/%d", pid);
-               rv = stat(dir, &buf);
-               if (rv != -1) {
-                       if (scan) {
-                               pr_err("Only one autorebuild process allowed in 
scan mode, aborting\n");
-                               fclose(fp);
-                               return 1;
-                       } else {
-                               pr_err("Warning: One autorebuild process 
already running.\n");
+               snprintf(comm_path, sizeof(comm_path),
+                        "/proc/%d/comm", pid);
+               comm_fp = fopen(comm_path, "r");
+               if (comm_fp) {
+                       if (fscanf(comm_fp, "%s", comm) &&
+                           strncmp(basename(comm), Name, strlen(Name)) == 0) {
+                               if (scan) {
+                                       pr_err("Only one autorebuild process 
allowed in scan mode, aborting\n");
+                                       fclose(comm_fp);
+                                       fclose(fp);
+                                       return 1;
+                               } else {
+                                       pr_err("Warning: One autorebuild 
process already running.\n");
+                               }
                        }
+                       fclose(comm_fp);
                }
                fclose(fp);
        }
-- 
2.25.0

++++++ 0072-Detail-adding-sync-status-for-cluster-device.patch ++++++
>From 1c294b5d960abeeb9e0f188af294d019bc82b20e Mon Sep 17 00:00:00 2001
From: Lidong Zhong <[email protected]>
Date: Tue, 14 Apr 2020 16:19:41 +0800
Subject: [PATCH] Detail: adding sync status for cluster device
Git-commit: 1c294b5d960abeeb9e0f188af294d019bc82b20e
Patch-mainline: mdadm-4.1+
References: bsc#1163727

On the node with /proc/mdstat is

Personalities : [raid1]
md0 : active raid1 sdb[4] sdc[3] sdd[2]
      1046528 blocks super 1.2 [3/2] [UU_]
        recover=REMOTE
      bitmap: 1/1 pages [4KB], 65536KB chunk

Let's change the 'State' of 'mdadm -Q -D' accordingly
State : clean, degraded
With this patch, it will be
State : clean, degraded, recovering (REMOTE)

Signed-off-by: Lidong Zhong <[email protected]>
Acked-by: Guoqing Jiang <[email protected]>
Signed-off-by: Jes Sorensen <[email protected]>
---
 Detail.c | 9 ++++++---
 mdadm.h  | 3 ++-
 mdstat.c | 2 ++
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/Detail.c b/Detail.c
index daec4f1..24eeba0 100644
--- a/Detail.c
+++ b/Detail.c
@@ -498,17 +498,20 @@ int Detail(char *dev, struct context *c)
                        } else
                                arrayst = "active";
 
-                       printf("             State : %s%s%s%s%s%s \n",
+                       printf("             State : %s%s%s%s%s%s%s \n",
                               arrayst, st,
                               (!e || (e->percent < 0 &&
                                       e->percent != RESYNC_PENDING &&
-                                      e->percent != RESYNC_DELAYED)) ?
+                                      e->percent != RESYNC_DELAYED &&
+                                      e->percent != RESYNC_REMOTE)) ?
                               "" : sync_action[e->resync],
                               larray_size ? "": ", Not Started",
                               (e && e->percent == RESYNC_DELAYED) ?
                               " (DELAYED)": "",
                               (e && e->percent == RESYNC_PENDING) ?
-                              " (PENDING)": "");
+                              " (PENDING)": "",
+                              (e && e->percent == RESYNC_REMOTE) ?
+                              " (REMOTE)": "");
                } else if (inactive && !is_container) {
                        printf("             State : inactive\n");
                }
diff --git a/mdadm.h b/mdadm.h
index d94569f..399478b 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -1815,7 +1815,8 @@ enum r0layout {
 #define RESYNC_NONE -1
 #define RESYNC_DELAYED -2
 #define RESYNC_PENDING -3
-#define RESYNC_UNKNOWN -4
+#define RESYNC_REMOTE  -4
+#define RESYNC_UNKNOWN -5
 
 /* When using "GET_DISK_INFO" it isn't certain how high
  * we need to check.  So we impose an absolute limit of
diff --git a/mdstat.c b/mdstat.c
index 7e600d0..20577a3 100644
--- a/mdstat.c
+++ b/mdstat.c
@@ -257,6 +257,8 @@ struct mdstat_ent *mdstat_read(int hold, int start)
                                        ent->percent = RESYNC_DELAYED;
                                if (l > 8 && strcmp(w+l-8, "=PENDING") == 0)
                                        ent->percent = RESYNC_PENDING;
+                               if (l > 7 && strcmp(w+l-7, "=REMOTE") == 0)
+                                       ent->percent = RESYNC_REMOTE;
                        } else if (ent->percent == RESYNC_NONE &&
                                   w[0] >= '0' &&
                                   w[0] <= '9' &&
-- 
2.25.0

++++++ 1002-OnCalendar-format-fix-of-mdcheck_start-timer.patch ++++++
From: Ali Abdallah <[email protected]>
Subject: OnCalendar format fix of mdcheck_start.timer
Patch-mainline: in-house patch at this moment, will post to upstream in future
References: bsc#1173137

This patch includes the fix of the OnCalendar format, changing the format of
mdcheck_start.timer [Timer] section,
from OnCalendar=Sun *-*-1..7 1:00:00
to   OnCalendar=Sun *-*-* 1:00:00

Signed-off-by:  Ali Abdallah <[email protected]>
Acked-by: Coly Li <[email protected]>
Index: mdadm-4.1/systemd/mdcheck_start.timer
===================================================================
--- mdadm-4.1.orig/systemd/mdcheck_start.timer
+++ mdadm-4.1/systemd/mdcheck_start.timer
@@ -9,7 +9,7 @@
 Description=MD array scrubbing
 
 [Timer]
-OnCalendar=Sun *-*-1..7 1:00:00
+OnCalendar=Sun *-*-* 1:00:00
 
 [Install]
 WantedBy= mdmonitor.service

Reply via email to