Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package mdadm for openSUSE:Factory checked 
in at 2021-03-29 18:21:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/mdadm (Old)
 and      /work/SRC/openSUSE:Factory/.mdadm.new.2401 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "mdadm"

Mon Mar 29 18:21:03 2021 rev:127 rq:880599 version:4.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/mdadm/mdadm.changes      2021-01-10 
19:38:51.633479378 +0100
+++ /work/SRC/openSUSE:Factory/.mdadm.new.2401/mdadm.changes    2021-03-29 
18:21:06.114220741 +0200
@@ -1,0 +2,7 @@
+Wed Mar 17 02:35:00 UTC 2021 - Heming Zhao <heming.z...@suse.com>
+
+- cluster-md/mdadm : avoid useless re-sync (bsc#1181341)
+  0114-super1-fix-Floating-point-exception.patch
+  0115-super1.c-avoid-useless-sync-when-bitmap-switches-fro.patch
+
+-------------------------------------------------------------------

New:
----
  0114-super1-fix-Floating-point-exception.patch
  0115-super1.c-avoid-useless-sync-when-bitmap-switches-fro.patch

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

Other differences:
------------------
++++++ mdadm.spec ++++++
--- /var/tmp/diff_new_pack.GyzUWn/_old  2021-03-29 18:21:07.810222477 +0200
+++ /var/tmp/diff_new_pack.GyzUWn/_new  2021-03-29 18:21:07.814222481 +0200
@@ -150,6 +150,8 @@
 Patch111:       0111-udev-start-grow-service-automatically.patch
 Patch112:       0112-Incremental-Remove-redundant-spare-movement-logic.patch
 Patch113:       0113-Dump-get-stat-from-a-wrong-metadata-file-when-restor.patch
+Patch114:       0114-super1-fix-Floating-point-exception.patch
+Patch115:       0115-super1.c-avoid-useless-sync-when-bitmap-switches-fro.patch
 Patch1001:      1001-display-timeout-status.patch
 Patch1002:      1002-OnCalendar-format-fix-of-mdcheck_start-timer.patch
 Patch1003:      1003-mdadm-treat-the-Dell-softraid-array-as-local-array.patch
@@ -270,6 +272,8 @@
 %patch111 -p1
 %patch112 -p1
 %patch113 -p1
+%patch114 -p1
+%patch115 -p1
 %patch1001 -p1
 %patch1002 -p1
 %patch1003 -p1

++++++ 0114-super1-fix-Floating-point-exception.patch ++++++
>From e6561c4defe853eaa6be27da0bb6bbd36e197b1f Mon Sep 17 00:00:00 2001
From: Zhao Heming <heming.z...@suse.com>
Date: Sat, 30 Jan 2021 17:49:54 +0800
Subject: [PATCH 1/2] super1: fix Floating point exception

write_bitmap1 didn't check return value of locate_bitmap1, which will
operate bitmap area under invalid bitmap info.

mdadm core dumped when doing below steps:
```
node1 # mdadm -C /dev/md0 -b none -e 1.2 -n 2 -l mirror /dev/sda /dev/sdb
node1 # mdadm -Ss
node1 # mdadm -A -U home-cluster --home-cluster=abc /dev/md0 /dev/sda /dev/sdb
Floating point exception (core dumped)
```

Signed-off-by: Zhao Heming <heming.z...@suse.com>
Signed-off-by: Jes Sorensen <jsoren...@fb.com>
---
 super1.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/super1.c b/super1.c
index 7bee02659b18..70aa1d3d0219 100644
--- a/super1.c
+++ b/super1.c
@@ -2717,7 +2717,10 @@ static int write_bitmap1(struct supertype *st, int fd, 
enum bitmap_update update
 
        init_afd(&afd, fd);
 
-       locate_bitmap1(st, fd, 0);
+       if (locate_bitmap1(st, fd, 0) < 0) {
+               pr_err("Error: Invalid bitmap\n");
+               return -EINVAL;
+       }
 
        if (posix_memalign(&buf, 4096, 4096))
                return -ENOMEM;
-- 
1.8.3.1

++++++ 0115-super1.c-avoid-useless-sync-when-bitmap-switches-fro.patch ++++++
>From f7a6246bab1541d7208a5f0f9f0c6cac114e38da Mon Sep 17 00:00:00 2001
From: Zhao Heming <heming.z...@suse.com>
Date: Wed, 3 Feb 2021 08:22:51 +0800
Subject: [PATCH 2/2] super1.c: avoid useless sync when bitmap switches from
 clustered to none

With kernel commit 480523feae58 ("md: only call set_in_sync() when it
is expected to succeed."), mddev->in_sync in clustered array is always
zero. It makes metadata resync_offset to always zero.
When assembling a clusterd array with "-U no-bitmap" option, kernel
md layer "mddev->resync_offset == 0" and "mddev->bitmap == NULL" will
trigger raid1 do sync on every bitmap chunk. the sync action is useless,
we should avoid it.

Related kernel flow:
```
md_do_sync
 mddev->pers->sync_request
  raid1_sync_request
   md_bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, 1)
    __bitmap_start_sync(bitmap, offset,&blocks1, degraded)
      if (bitmap == NULL) {/* FIXME or bitmap set as 'failed' */
        *blocks = 1024;
        return 1; /* always resync if no bitmap */
      }
```

Reprodusible steps:
```
node1 # mdadm -C /dev/md0 -b clustered -e 1.2 -n 2 -l mirror /dev/sd{a,b}
node1 # mdadm -Ss
(in another shell, executing & watching: watch -n 1 'cat /proc/mdstat')
node1 # mdadm -A -U no-bitmap /dev/md0 /dev/sd{a,b}
```

Signed-off-by: Zhao Heming <heming.z...@suse.com>
Signed-off-by: Jes Sorensen <jsoren...@fb.com>
---
 super1.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/super1.c b/super1.c
index 70aa1d3d0219..7b03329dac91 100644
--- a/super1.c
+++ b/super1.c
@@ -1346,6 +1346,8 @@ static int update_super1(struct supertype *st, struct 
mdinfo *info,
                        memcpy(bms->uuid, sb->set_uuid, 16);
        } else if (strcmp(update, "no-bitmap") == 0) {
                sb->feature_map &= ~__cpu_to_le32(MD_FEATURE_BITMAP_OFFSET);
+               if (bms->version == BITMAP_MAJOR_CLUSTERED && 
!IsBitmapDirty(devname))
+                       sb->resync_offset = MaxSector;
        } else if (strcmp(update, "bbl") == 0) {
                /* only possible if there is room after the bitmap, or if
                 * there is no bitmap
-- 
1.8.3.1

Reply via email to