Update to 4.1 rc2

This commit is contained in:
Peter Robinson 2018-08-26 23:11:04 +01:00
parent 9aa4b640d2
commit 9c6a0aeb2d
32 changed files with 7 additions and 2069 deletions

21
.gitignore vendored
View File

@ -1,24 +1,5 @@
mdadm-3.0.3.tar.bz2
mdadm-3.1.1-gcd9a8b5.tar.bz2
mdadm-3.1.2.tar.bz2
mdadm-3.1.3-git07202010.tar.bz2
mdadm-3.1.3-git20100722.tar.bz2
mdadm-3.1.3-git20100804.tar.bz2
mdadm-3.1.5.tar.bz2
.build* .build*
clog clog
*.src.rpm *.src.rpm
*/ */
/mdadm-3.2.1.tar.bz2 /mdadm-4.*.tar.xz
/mdadm-3.2.2.tar.bz2
/mdadm-3.2.3.tar.bz2
/mdadm-3.2.4.tar.xz
/mdadm-3.2.5.tar.xz
/mdadm-3.2.6.tar.xz
/mdadm-3.3.tar.xz
/mdadm-3.3.1.tar.xz
/mdadm-3.3.2.tar.xz
/mdadm-3.3.4.tar.xz
/mdadm-3.4.tar.xz
/mdadm-4.0.tar.xz
/mdadm-4.1-rc1.tar.xz

View File

@ -1,95 +0,0 @@
From 834b7260c7184ca5df369e977a27ffb44ac3a615 Mon Sep 17 00:00:00 2001
From: Xiao Ni <xni@redhat.com>
Date: Mon, 11 Dec 2017 13:47:38 +0800
Subject: [RHEL7.5 PATCH 1/1] Disable raid5 journal function
Resolves: rhbz#1518477
Signed-off-by: Xiao Ni <xni@redhat.com>
---
disable-journal.patch | 32 ++++++++++++++++++++++++++++++++
mdadm.spec | 8 +++++++-
2 files changed, 39 insertions(+), 1 deletion(-)
create mode 100644 disable-journal.patch
diff --git a/disable-journal.patch b/disable-journal.patch
new file mode 100644
index 0000000..1bd67c3
--- /dev/null
+++ b/disable-journal.patch
@@ -0,0 +1,32 @@
+--- a/ReadMe.c~ 2017-12-11 11:15:10.314176222 +0800
++++ b/ReadMe.c 2017-12-11 11:16:42.451297334 +0800
+@@ -147,7 +147,9 @@
+ {"data-offset",1, 0, DataOffset},
+ {"nodes",1, 0, Nodes}, /* also for --assemble */
+ {"home-cluster",1, 0, ClusterName},
++#if 0 /*Disable for rhel7.5*/
+ {"write-journal",1, 0, WriteJournal},
++#endif
+ {"consistency-policy", 1, 0, 'k'},
+
+ /* For assemble */
+@@ -163,7 +165,9 @@
+ /* Management */
+ {"add", 0, 0, Add},
+ {"add-spare", 0, 0, AddSpare},
++#if 0 /*Disable for rhel7.5*/
+ {"add-journal", 0, 0, AddJournal},
++#endif
+ {"remove", 0, 0, Remove},
+ {"fail", 0, 0, Fail},
+ {"set-faulty",0, 0, Fail},
+@@ -383,7 +387,9 @@
+ " --name= -N : Textual name for array - max 32 characters\n"
+ " --bitmap-chunk= : bitmap chunksize in Kilobytes.\n"
+ " --delay= -d : bitmap update delay in seconds.\n"
++#if 0 /*Disable for rhel7.5*/
+ " --write-journal= : Specify journal device for RAID-4/5/6 array\n"
++#endif
+ " --consistency-policy= : Specify the policy that determines how the array\n"
+ " -k : maintains consistency in case of unexpected shutdown.\n"
+ "\n"
diff --git a/mdadm.spec b/mdadm.spec
index 3e71342..0b75bb0 100644
--- a/mdadm.spec
+++ b/mdadm.spec
@@ -1,7 +1,7 @@
Summary: The mdadm program controls Linux md devices (software RAID arrays)
Name: mdadm
Version: 4.0
-Release: 9%{?dist}
+Release: 10%{?dist}
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz
Source1: mdmonitor.init
Source2: raid-check
@@ -207,6 +207,7 @@ Patch195: mdadm-3.4-udev-race.patch
Patch196: mdadm-3.3.2-skip-rules.patch
Patch197: mdadm-3.3-udev.patch
Patch198: mdadm-2.5.2-static.patch
+Patch199: disable-journal.patch
URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/
License: GPLv2+
Group: System Environment/Base
@@ -426,6 +427,7 @@ file can be used to help with some common tasks.
%patch196 -p1 -b .rules
%patch197 -p1 -b .udev
%patch198 -p1 -b .static
+%patch199 -p1 -b .disable
%build
make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" SYSCONFDIR="%{_sysconfdir}" mdadm mdmon
@@ -487,6 +489,10 @@ rm -rf %{buildroot}
/etc/libreport/events.d/*
%changelog
+* Mon Dec 11 2017 Xiao Ni <xni@redhat.com> - 4.0-10
+- Disable raid5 journal function
+- Resolves rhbz#1518477
+
* Fri Nov 03 2017 Xiao Ni <xni@redhat.com> - 4.0-9
- Enable raid5 journal function
- Resolves rhbz1505611
--
2.7.4

View File

@ -1,103 +0,0 @@
From d7d48046311693d0300bbf47ceddfe9db5fdb461 Mon Sep 17 00:00:00 2001
From: Xiao Ni <xni@redhat.com>
Date: Fri, 3 Nov 2017 13:15:54 +0800
Subject: [RHEL7.5 PATCH 1/2] Enable raid5 journal function
Resolves: rhbz1505611
Signed-off-by: Xiao Ni <xni@redhat.com>
---
disable-journal.patch | 34 ----------------------------------
mdadm.spec | 9 +++++----
2 files changed, 5 insertions(+), 38 deletions(-)
delete mode 100644 disable-journal.patch
diff --git a/disable-journal.patch b/disable-journal.patch
deleted file mode 100644
index 7631164..0000000
--- a/disable-journal.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-diff --git a/ReadMe.c b/ReadMe.c
-index eb8fb4b..2de30e1 100644
---- a/ReadMe.c
-+++ b/ReadMe.c
-@@ -147,7 +147,9 @@ struct option long_options[] = {
- {"data-offset",1, 0, DataOffset},
- {"nodes",1, 0, Nodes}, /* also for --assemble */
- {"home-cluster",1, 0, ClusterName},
-+#if 0 /* Disable for RHEL */
- {"write-journal",1, 0, WriteJournal},
-+#endif
- {"consistency-policy", 1, 0, 'k'},
-
- /* For assemble */
-@@ -163,7 +165,9 @@ struct option long_options[] = {
- /* Management */
- {"add", 0, 0, Add},
- {"add-spare", 0, 0, AddSpare},
-+#if 0 /* Disable for RHEL */
- {"add-journal", 0, 0, AddJournal},
-+#endif
- {"remove", 0, 0, Remove},
- {"fail", 0, 0, Fail},
- {"set-faulty",0, 0, Fail},
-@@ -383,7 +387,9 @@ char Help_create[] =
- " --name= -N : Textual name for array - max 32 characters\n"
- " --bitmap-chunk= : bitmap chunksize in Kilobytes.\n"
- " --delay= -d : bitmap update delay in seconds.\n"
-+#if 0 /* Disable for RHEL */
- " --write-journal= : Specify journal device for RAID-4/5/6 array\n"
-+#endif
- " --consistency-policy= : Specify the policy that determines how the array\n"
- " -k : maintains consistency in case of unexpected shutdown.\n"
- "\n"
diff --git a/mdadm.spec b/mdadm.spec
index 580ea81..3e71342 100644
--- a/mdadm.spec
+++ b/mdadm.spec
@@ -1,7 +1,7 @@
Summary: The mdadm program controls Linux md devices (software RAID arrays)
Name: mdadm
Version: 4.0
-Release: 8%{?dist}
+Release: 9%{?dist}
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz
Source1: mdmonitor.init
Source2: raid-check
@@ -207,7 +207,6 @@ Patch195: mdadm-3.4-udev-race.patch
Patch196: mdadm-3.3.2-skip-rules.patch
Patch197: mdadm-3.3-udev.patch
Patch198: mdadm-2.5.2-static.patch
-Patch199: disable-journal.patch
URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/
License: GPLv2+
Group: System Environment/Base
@@ -422,13 +421,11 @@ file can be used to help with some common tasks.
%patch187 -p1 -b .validating
%patch188 -p1 -b .initial
-
# RHEL customization patches
%patch195 -p1 -b .race
%patch196 -p1 -b .rules
%patch197 -p1 -b .udev
%patch198 -p1 -b .static
-%patch199 -p1 -b .journal
%build
make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" SYSCONFDIR="%{_sysconfdir}" mdadm mdmon
@@ -490,6 +487,10 @@ rm -rf %{buildroot}
/etc/libreport/events.d/*
%changelog
+* Fri Nov 03 2017 Xiao Ni <xni@redhat.com> - 4.0-9
+- Enable raid5 journal function
+- Resolves rhbz1505611
+
* Fri Nov 03 2017 Xiao Ni <xni@redhat.com> - 4.0-8
- Support for multiple-ppl in mdadm
- Resolves rhbz#1500638
--
2.7.4

View File

@ -1,37 +0,0 @@
From 1c7c65a3e5d3e5f6d32bfa4cf0d872f87c654eb2 Mon Sep 17 00:00:00 2001
From: Zhipeng Xie <xiezhipeng1@huawei.com>
Date: Tue, 10 Apr 2018 09:25:39 +0800
Subject: [RHEL7.5 PATCH 01/26] mdadm: fix use-after-free after free_mdstat
e->percent access the mdstat_ent which was already freed in free_mdstat
Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
Detail.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Detail.c b/Detail.c
index 4dcf81d..860241c 100644
--- a/Detail.c
+++ b/Detail.c
@@ -561,7 +561,6 @@ int Detail(char *dev, struct context *c)
printf(" %7s Status : %d%% complete\n",
sync_action[e->resync], e->percent);
}
- free_mdstat(ms);
if ((st && st->sb) && (info && info->reshape_active)) {
#if 0
@@ -609,6 +608,8 @@ This is pretty boring
printf("\n");
} else if (e && e->percent >= 0)
printf("\n");
+ free_mdstat(ms);
+
if (st && st->sb)
st->ss->detail_super(st, c->homehost);
--
2.7.4

View File

@ -1,95 +0,0 @@
From 834b7260c7184ca5df369e977a27ffb44ac3a615 Mon Sep 17 00:00:00 2001
From: Xiao Ni <xni@redhat.com>
Date: Mon, 11 Dec 2017 13:47:38 +0800
Subject: [RHEL7.5 PATCH 2/2] Disable raid5 journal function
Resolves: rhbz#1518477
Signed-off-by: Xiao Ni <xni@redhat.com>
---
disable-journal.patch | 32 ++++++++++++++++++++++++++++++++
mdadm.spec | 8 +++++++-
2 files changed, 39 insertions(+), 1 deletion(-)
create mode 100644 disable-journal.patch
diff --git a/disable-journal.patch b/disable-journal.patch
new file mode 100644
index 0000000..1bd67c3
--- /dev/null
+++ b/disable-journal.patch
@@ -0,0 +1,32 @@
+--- a/ReadMe.c~ 2017-12-11 11:15:10.314176222 +0800
++++ b/ReadMe.c 2017-12-11 11:16:42.451297334 +0800
+@@ -147,7 +147,9 @@
+ {"data-offset",1, 0, DataOffset},
+ {"nodes",1, 0, Nodes}, /* also for --assemble */
+ {"home-cluster",1, 0, ClusterName},
++#if 0 /*Disable for rhel7.5*/
+ {"write-journal",1, 0, WriteJournal},
++#endif
+ {"consistency-policy", 1, 0, 'k'},
+
+ /* For assemble */
+@@ -163,7 +165,9 @@
+ /* Management */
+ {"add", 0, 0, Add},
+ {"add-spare", 0, 0, AddSpare},
++#if 0 /*Disable for rhel7.5*/
+ {"add-journal", 0, 0, AddJournal},
++#endif
+ {"remove", 0, 0, Remove},
+ {"fail", 0, 0, Fail},
+ {"set-faulty",0, 0, Fail},
+@@ -383,7 +387,9 @@
+ " --name= -N : Textual name for array - max 32 characters\n"
+ " --bitmap-chunk= : bitmap chunksize in Kilobytes.\n"
+ " --delay= -d : bitmap update delay in seconds.\n"
++#if 0 /*Disable for rhel7.5*/
+ " --write-journal= : Specify journal device for RAID-4/5/6 array\n"
++#endif
+ " --consistency-policy= : Specify the policy that determines how the array\n"
+ " -k : maintains consistency in case of unexpected shutdown.\n"
+ "\n"
diff --git a/mdadm.spec b/mdadm.spec
index 3e71342..0b75bb0 100644
--- a/mdadm.spec
+++ b/mdadm.spec
@@ -1,7 +1,7 @@
Summary: The mdadm program controls Linux md devices (software RAID arrays)
Name: mdadm
Version: 4.0
-Release: 9%{?dist}
+Release: 10%{?dist}
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz
Source1: mdmonitor.init
Source2: raid-check
@@ -207,6 +207,7 @@ Patch195: mdadm-3.4-udev-race.patch
Patch196: mdadm-3.3.2-skip-rules.patch
Patch197: mdadm-3.3-udev.patch
Patch198: mdadm-2.5.2-static.patch
+Patch199: disable-journal.patch
URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/
License: GPLv2+
Group: System Environment/Base
@@ -426,6 +427,7 @@ file can be used to help with some common tasks.
%patch196 -p1 -b .rules
%patch197 -p1 -b .udev
%patch198 -p1 -b .static
+%patch199 -p1 -b .disable
%build
make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" SYSCONFDIR="%{_sysconfdir}" mdadm mdmon
@@ -487,6 +489,10 @@ rm -rf %{buildroot}
/etc/libreport/events.d/*
%changelog
+* Mon Dec 11 2017 Xiao Ni <xni@redhat.com> - 4.0-10
+- Disable raid5 journal function
+- Resolves rhbz#1518477
+
* Fri Nov 03 2017 Xiao Ni <xni@redhat.com> - 4.0-9
- Enable raid5 journal function
- Resolves rhbz1505611
--
2.7.4

View File

@ -1,36 +0,0 @@
From b91ad097d6eecb85cf28915836370288709fbda8 Mon Sep 17 00:00:00 2001
From: Michal Zylowski <michal.zylowski@intel.com>
Date: Wed, 4 Apr 2018 14:20:17 +0200
Subject: [RHEL7.5 PATCH 02/26] imsm: Allow create RAID volume with link to
container
After 1db03765("Subdevs can't be all missing when create raid device")
raid volume can't be created with link to container. This feature should
not be blocked in Create function. IMSM code forbids creation of
container with missing disk, so case like all dev's missing is already
handled.
Permit IMSM volume creation when devices are given as link to container.
Signed-off-by: Michal Zylowski <michal.zylowski@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
Create.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Create.c b/Create.c
index 50142d8..04b1dfc 100644
--- a/Create.c
+++ b/Create.c
@@ -475,7 +475,7 @@ int Create(struct supertype *st, char *mddev,
close(fd);
}
}
- if (missing_disks == dnum) {
+ if (missing_disks == dnum && !have_container) {
pr_err("Subdevs can't be all missing\n");
return 1;
}
--
2.7.4

View File

@ -1,80 +0,0 @@
From 59416da78fc66084f721163b914913dc1da37b44 Mon Sep 17 00:00:00 2001
From: Jes Sorensen <jsorensen@fb.com>
Date: Wed, 11 Apr 2018 17:01:50 -0400
Subject: [RHEL7.5 PATCH 03/26] tests/func.sh: Fix some total breakage in the
test scripts
We will never mandate an obsolete file system such as ext[2-4] for
running the test suite, nor should the test version of mdadm be
installed on the system for the tests to be run.
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Fixes: 20d10b4be873ba ("mdadm/test: Refactor and revamp 'test' script")
---
test | 2 +-
tests/func.sh | 22 +++-------------------
2 files changed, 4 insertions(+), 20 deletions(-)
diff --git a/test b/test
index 111a2e7..711a3c7 100755
--- a/test
+++ b/test
@@ -5,7 +5,7 @@ mdadm=$PWD/mdadm
targetdir="/var/tmp"
logdir="$targetdir"
config=/tmp/mdadm.conf
-testdir=
+testdir=$PWD/tests
devlist=
savelogs=0
diff --git a/tests/func.sh b/tests/func.sh
index a6995f1..9710a53 100644
--- a/tests/func.sh
+++ b/tests/func.sh
@@ -101,8 +101,8 @@ check_env() {
echo "test: testing can only be done as 'root'."
exit 1
}
- [ -x "raid6check" -a -x $mdadm ] || {
- echo "test: please run 'make everything' before perform testing."
+ [ \! -x $mdadm ] && {
+ echo "test: please run make everything before perform testing."
exit 1
}
cmds=(mdadm lsblk df udevadm losetup mkfs.ext3 fsck seq)
@@ -113,23 +113,6 @@ check_env() {
exit 1
}
done
- mdadm_src_ver="$($mdadm -V 2>&1)"
- mdadm_sbin_ver="$($(which mdadm) -V 2>&1)"
- if [ "$mdadm_src_ver" != "$mdadm_sbin_ver" ]
- then
- # it's nessesary to 'make install' mdadm to /SBIN/DIR,
- # such as systemd/mdadm-grow-continue@.service, would
- # run as an instance by systemd when reshape happens,
- # thus ensure that the correct mdadm is in testing.
- echo "test: please run 'make install' before testing."
- exit 1
- fi
- if ! $(df -T . | grep -iq ext)
- then
- # 'external file' bitmap only supports with ext[2-4] file system
- echo "test: please run test suite with ext[2-4] file system."
- exit 1
- fi
if $(lsblk -a | grep -iq raid)
then
# donot run mdadm -Ss directly if there are RAIDs working.
@@ -231,6 +214,7 @@ check() {
if [ $? -eq 0 ]; then
die "This command shouldn't run successfully"
fi
+ ;;
spares )
spares=$(tr '] ' '\012\012' < /proc/mdstat | grep -c '(S)' || exit 0)
[ $spares -ne $2 ] &&
--
2.7.4

View File

@ -1,32 +0,0 @@
From 611d95290dd41d73bd8f9cc06f7ec293a40b819e Mon Sep 17 00:00:00 2001
From: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
Date: Thu, 5 Apr 2018 13:38:35 +0200
Subject: [RHEL7.5 PATCH 04/26] imsm: change reserved space to 4MB
Due to compatibility to the newest OROM, imsm reserved space has to be
expanded to 4MB.
Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
super-intel.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index fb1b693..52011e5 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -88,8 +88,8 @@
#define MPB_ATTRIB_IGNORED (MPB_ATTRIB_NEVER_USE)
#define MPB_SECTOR_CNT 2210
-#define IMSM_RESERVED_SECTORS 4096
-#define NUM_BLOCKS_DIRTY_STRIPE_REGION 2056
+#define IMSM_RESERVED_SECTORS 8192
+#define NUM_BLOCKS_DIRTY_STRIPE_REGION 2048
#define SECT_PER_MB_SHIFT 11
#define MAX_SECTOR_SIZE 4096
#define MULTIPLE_PPL_AREA_SIZE_IMSM (1024 * 1024) /* Size of the whole
--
2.7.4

View File

@ -1,137 +0,0 @@
From fcc2c9daede11fcc67e4032fd6fa8da198aaa319 Mon Sep 17 00:00:00 2001
From: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
Date: Thu, 5 Apr 2018 13:38:36 +0200
Subject: [RHEL7.5 PATCH 05/26] imsm: add functions to get and set imsm dev
size
Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
super-intel.c | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index 52011e5..fe2a705 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -1201,6 +1201,13 @@ static unsigned long long num_data_stripes(struct imsm_map *map)
return join_u32(map->num_data_stripes_lo, map->num_data_stripes_hi);
}
+static unsigned long long imsm_dev_size(struct imsm_dev *dev)
+{
+ if (dev == NULL)
+ return 0;
+ return join_u32(dev->size_low, dev->size_high);
+}
+
static void set_total_blocks(struct imsm_disk *disk, unsigned long long n)
{
split_ull(n, &disk->total_blocks_lo, &disk->total_blocks_hi);
@@ -1221,6 +1228,11 @@ static void set_num_data_stripes(struct imsm_map *map, unsigned long long n)
split_ull(n, &map->num_data_stripes_lo, &map->num_data_stripes_hi);
}
+static void set_imsm_dev_size(struct imsm_dev *dev, unsigned long long n)
+{
+ split_ull(n, &dev->size_low, &dev->size_high);
+}
+
static struct extent *get_extents(struct intel_super *super, struct dl *dl)
{
/* find a list of used extents on the given physical device */
@@ -1503,9 +1515,7 @@ static void print_imsm_dev(struct intel_super *super,
} else
printf(" This Slot : ?\n");
printf(" Sector Size : %u\n", super->sector_size);
- sz = __le32_to_cpu(dev->size_high);
- sz <<= 32;
- sz += __le32_to_cpu(dev->size_low);
+ sz = imsm_dev_size(dev);
printf(" Array Size : %llu%s\n",
(unsigned long long)sz * 512 / super->sector_size,
human_size(sz * 512));
@@ -1634,8 +1644,7 @@ void convert_to_4k(struct intel_super *super)
struct imsm_dev *dev = __get_imsm_dev(mpb, i);
struct imsm_map *map = get_imsm_map(dev, MAP_0);
/* dev */
- split_ull((join_u32(dev->size_low, dev->size_high)/IMSM_4K_DIV),
- &dev->size_low, &dev->size_high);
+ set_imsm_dev_size(dev, imsm_dev_size(dev)/IMSM_4K_DIV);
dev->vol.curr_migr_unit /= IMSM_4K_DIV;
/* map0 */
@@ -1762,8 +1771,7 @@ void convert_from_4k(struct intel_super *super)
struct imsm_dev *dev = __get_imsm_dev(mpb, i);
struct imsm_map *map = get_imsm_map(dev, MAP_0);
/* dev */
- split_ull((join_u32(dev->size_low, dev->size_high)*IMSM_4K_DIV),
- &dev->size_low, &dev->size_high);
+ set_imsm_dev_size(dev, imsm_dev_size(dev)*IMSM_4K_DIV);
dev->vol.curr_migr_unit *= IMSM_4K_DIV;
/* map0 */
@@ -3240,9 +3248,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
info->array.chunk_size =
__le16_to_cpu(map_to_analyse->blocks_per_strip) << 9;
info->array.state = !(dev->vol.dirty & RAIDVOL_DIRTY);
- info->custom_array_size = __le32_to_cpu(dev->size_high);
- info->custom_array_size <<= 32;
- info->custom_array_size |= __le32_to_cpu(dev->size_low);
+ info->custom_array_size = imsm_dev_size(dev);
info->recovery_blocked = imsm_reshape_blocks_arrays_changes(st->sb);
if (is_gen_migration(dev)) {
@@ -5370,8 +5376,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
array_blocks = round_size_to_mb(array_blocks, data_disks);
size_per_member = array_blocks / data_disks;
- dev->size_low = __cpu_to_le32((__u32) array_blocks);
- dev->size_high = __cpu_to_le32((__u32) (array_blocks >> 32));
+ set_imsm_dev_size(dev, array_blocks);
dev->status = (DEV_READ_COALESCING | DEV_WRITE_COALESCING);
vol = &dev->vol;
vol->migr_state = 0;
@@ -7733,7 +7738,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
level, /* RAID level */
imsm_level_to_layout(level),
map->num_members, /* raid disks */
- &chunk, join_u32(dev->size_low, dev->size_high),
+ &chunk, imsm_dev_size(dev),
1 /* verbose */)) {
pr_err("IMSM RAID geometry validation failed. Array %s activation is blocked.\n",
dev->volume);
@@ -8143,9 +8148,7 @@ static unsigned long long imsm_set_array_size(struct imsm_dev *dev,
/* when problems occures
* return current array_blocks value
*/
- array_blocks = __le32_to_cpu(dev->size_high);
- array_blocks = array_blocks << 32;
- array_blocks += __le32_to_cpu(dev->size_low);
+ array_blocks = imsm_dev_size(dev);
return array_blocks;
}
@@ -8165,8 +8168,7 @@ static unsigned long long imsm_set_array_size(struct imsm_dev *dev,
}
array_blocks = round_size_to_mb(array_blocks, used_disks);
- dev->size_low = __cpu_to_le32((__u32)array_blocks);
- dev->size_high = __cpu_to_le32((__u32)(array_blocks >> 32));
+ set_imsm_dev_size(dev, array_blocks);
return array_blocks;
}
@@ -9139,8 +9141,7 @@ static int apply_reshape_migration_update(struct imsm_update_reshape_migration *
map->blocks_per_strip =
__cpu_to_le16(u->new_chunksize * 2);
num_data_stripes =
- (join_u32(dev->size_low, dev->size_high)
- / used_disks);
+ imsm_dev_size(dev) / used_disks;
num_data_stripes /= map->blocks_per_strip;
num_data_stripes /= map->num_domains;
set_num_data_stripes(map, num_data_stripes);
--
2.7.4

View File

@ -1,179 +0,0 @@
From 9529d3436771d9f38884861683dee3b40ab9d180 Mon Sep 17 00:00:00 2001
From: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
Date: Thu, 5 Apr 2018 13:38:37 +0200
Subject: [RHEL7.5 PATCH 06/26] imsm: pass already existing map to
imsm_num_data_members
In almost every place where imsm_num_data_members is called there is
already existing map so it can be used it to avoid mistake when specifying
map for imsm_num_data_members.
Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
super-intel.c | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index fe2a705..3fc3cf4 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -2767,13 +2767,11 @@ static __u32 num_stripes_per_unit_rebuild(struct imsm_dev *dev)
return num_stripes_per_unit_resync(dev);
}
-static __u8 imsm_num_data_members(struct imsm_dev *dev, int second_map)
+static __u8 imsm_num_data_members(struct imsm_map *map)
{
/* named 'imsm_' because raid0, raid1 and raid10
* counter-intuitively have the same number of data disks
*/
- struct imsm_map *map = get_imsm_map(dev, second_map);
-
switch (get_imsm_raid_level(map)) {
case 0:
return map->num_members;
@@ -2862,7 +2860,7 @@ static __u64 blocks_per_migr_unit(struct intel_super *super,
*/
stripes_per_unit = num_stripes_per_unit_resync(dev);
migr_chunk = migr_strip_blocks_resync(dev);
- disks = imsm_num_data_members(dev, MAP_0);
+ disks = imsm_num_data_members(map);
blocks_per_unit = stripes_per_unit * migr_chunk * disks;
stripe = __le16_to_cpu(map->blocks_per_strip) * disks;
segment = blocks_per_unit / stripe;
@@ -3381,7 +3379,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
(unsigned long long)blocks_per_unit,
info->reshape_progress);
- used_disks = imsm_num_data_members(dev, MAP_1);
+ used_disks = imsm_num_data_members(prev_map);
if (used_disks > 0) {
array_blocks = blocks_per_member(map) *
used_disks;
@@ -8140,9 +8138,9 @@ static void handle_missing(struct intel_super *super, struct imsm_dev *dev)
static unsigned long long imsm_set_array_size(struct imsm_dev *dev,
long long new_size)
{
- int used_disks = imsm_num_data_members(dev, MAP_0);
unsigned long long array_blocks;
- struct imsm_map *map;
+ struct imsm_map *map = get_imsm_map(dev, MAP_0);
+ int used_disks = imsm_num_data_members(map);
if (used_disks == 0) {
/* when problems occures
@@ -8155,17 +8153,15 @@ static unsigned long long imsm_set_array_size(struct imsm_dev *dev,
/* set array size in metadata
*/
- if (new_size <= 0) {
+ if (new_size <= 0)
/* OLCE size change is caused by added disks
*/
- map = get_imsm_map(dev, MAP_0);
array_blocks = blocks_per_member(map) * used_disks;
- } else {
+ else
/* Online Volume Size Change
* Using available free space
*/
array_blocks = new_size;
- }
array_blocks = round_size_to_mb(array_blocks, used_disks);
set_imsm_dev_size(dev, array_blocks);
@@ -8274,7 +8270,7 @@ static int imsm_set_array_state(struct active_array *a, int consistent)
int used_disks;
struct mdinfo *mdi;
- used_disks = imsm_num_data_members(dev, MAP_0);
+ used_disks = imsm_num_data_members(map);
if (used_disks > 0) {
array_blocks =
blocks_per_member(map) *
@@ -9132,8 +9128,10 @@ static int apply_reshape_migration_update(struct imsm_update_reshape_migration *
*/
if (u->new_chunksize > 0) {
unsigned long long num_data_stripes;
+ struct imsm_map *dest_map =
+ get_imsm_map(dev, MAP_0);
int used_disks =
- imsm_num_data_members(dev, MAP_0);
+ imsm_num_data_members(dest_map);
if (used_disks == 0)
return ret_val;
@@ -9210,7 +9208,7 @@ static int apply_size_change_update(struct imsm_update_size_change *u,
if (id->index == (unsigned)u->subdev) {
struct imsm_dev *dev = get_imsm_dev(super, u->subdev);
struct imsm_map *map = get_imsm_map(dev, MAP_0);
- int used_disks = imsm_num_data_members(dev, MAP_0);
+ int used_disks = imsm_num_data_members(map);
unsigned long long blocks_per_member;
unsigned long long num_data_stripes;
@@ -10589,7 +10587,7 @@ void init_migr_record_imsm(struct supertype *st, struct imsm_dev *dev,
max(map_dest->blocks_per_strip, map_src->blocks_per_strip);
migr_rec->dest_depth_per_unit *=
max(map_dest->blocks_per_strip, map_src->blocks_per_strip);
- new_data_disks = imsm_num_data_members(dev, MAP_0);
+ new_data_disks = imsm_num_data_members(map_dest);
migr_rec->blocks_per_unit =
__cpu_to_le32(migr_rec->dest_depth_per_unit * new_data_disks);
migr_rec->dest_depth_per_unit =
@@ -10657,7 +10655,7 @@ int save_backup_imsm(struct supertype *st,
int dest_layout = 0;
int dest_chunk;
unsigned long long start;
- int data_disks = imsm_num_data_members(dev, MAP_0);
+ int data_disks = imsm_num_data_members(map_dest);
targets = xmalloc(new_disks * sizeof(int));
@@ -11279,6 +11277,7 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
int imsm_layout = -1;
int data_disks;
struct imsm_dev *dev;
+ struct imsm_map *map;
struct intel_super *super;
unsigned long long current_size;
unsigned long long free_size;
@@ -11369,7 +11368,8 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
super = st->sb;
dev = get_imsm_dev(super, super->current_vol);
- data_disks = imsm_num_data_members(dev , MAP_0);
+ map = get_imsm_map(dev, MAP_0);
+ data_disks = imsm_num_data_members(map);
/* compute current size per disk member
*/
current_size = info.custom_array_size / data_disks;
@@ -11838,7 +11838,7 @@ static int imsm_manage_reshape(
struct intel_dev *dv;
unsigned int sector_size = super->sector_size;
struct imsm_dev *dev = NULL;
- struct imsm_map *map_src;
+ struct imsm_map *map_src, *map_dest;
int migr_vol_qan = 0;
int ndata, odata; /* [bytes] */
int chunk; /* [bytes] */
@@ -11876,12 +11876,13 @@ static int imsm_manage_reshape(
goto abort;
}
+ map_dest = get_imsm_map(dev, MAP_0);
map_src = get_imsm_map(dev, MAP_1);
if (map_src == NULL)
goto abort;
- ndata = imsm_num_data_members(dev, MAP_0);
- odata = imsm_num_data_members(dev, MAP_1);
+ ndata = imsm_num_data_members(map_dest);
+ odata = imsm_num_data_members(map_src);
chunk = __le16_to_cpu(map_src->blocks_per_strip) * 512;
old_data_stripe_length = odata * chunk;
--
2.7.4

View File

@ -1,266 +0,0 @@
From 444909385fdaccf961308c4319d7029b82bf8bb1 Mon Sep 17 00:00:00 2001
From: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
Date: Thu, 5 Apr 2018 13:38:38 +0200
Subject: [RHEL7.5 PATCH 07/26] imsm: do not use blocks_per_member in array
size calculations
mdadm assumes that blocks_per_member value is equal to num_data_stripes *
blocks_per_stripe but it is not true. For IMSM arrays created in OROM
NUM_BLOCKS_DIRTY_STRIPE_REGION sectors are added up to this value. Because
of this mdadm shows invalid size of arrays created in OROM and to fix this
we need to use array size calculation based on num data stripes and blocks
per stripe.
Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
super-intel.c | 105 ++++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 76 insertions(+), 29 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index 3fc3cf4..c55c85f 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -1233,6 +1233,20 @@ static void set_imsm_dev_size(struct imsm_dev *dev, unsigned long long n)
split_ull(n, &dev->size_low, &dev->size_high);
}
+static unsigned long long per_dev_array_size(struct imsm_map *map)
+{
+ unsigned long long array_size = 0;
+
+ if (map == NULL)
+ return array_size;
+
+ array_size = num_data_stripes(map) * map->blocks_per_strip;
+ if (get_imsm_raid_level(map) == 1 || get_imsm_raid_level(map) == 10)
+ array_size *= 2;
+
+ return array_size;
+}
+
static struct extent *get_extents(struct intel_super *super, struct dl *dl)
{
/* find a list of used extents on the given physical device */
@@ -1259,7 +1273,7 @@ static struct extent *get_extents(struct intel_super *super, struct dl *dl)
if (get_imsm_disk_slot(map, dl->index) >= 0) {
e->start = pba_of_lba0(map);
- e->size = blocks_per_member(map);
+ e->size = per_dev_array_size(map);
e++;
}
}
@@ -2787,6 +2801,36 @@ static __u8 imsm_num_data_members(struct imsm_map *map)
}
}
+static unsigned long long calc_component_size(struct imsm_map *map,
+ struct imsm_dev *dev)
+{
+ unsigned long long component_size;
+ unsigned long long dev_size = imsm_dev_size(dev);
+ unsigned long long calc_dev_size = 0;
+ unsigned int member_disks = imsm_num_data_members(map);
+
+ if (member_disks == 0)
+ return 0;
+
+ component_size = per_dev_array_size(map);
+ calc_dev_size = component_size * member_disks;
+
+ /* Component size is rounded to 1MB so difference between size from
+ * metadata and size calculated from num_data_stripes equals up to
+ * 2048 blocks per each device. If the difference is higher it means
+ * that array size was expanded and num_data_stripes was not updated.
+ */
+ if ((unsigned int)abs(calc_dev_size - dev_size) >
+ (1 << SECT_PER_MB_SHIFT) * member_disks) {
+ component_size = dev_size / member_disks;
+ dprintf("Invalid num_data_stripes in metadata; expected=%llu, found=%llu\n",
+ component_size / map->blocks_per_strip,
+ num_data_stripes(map));
+ }
+
+ return component_size;
+}
+
static __u32 parity_segment_depth(struct imsm_dev *dev)
{
struct imsm_map *map = get_imsm_map(dev, MAP_0);
@@ -3306,14 +3350,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
}
info->data_offset = pba_of_lba0(map_to_analyse);
-
- if (info->array.level == 5) {
- info->component_size = num_data_stripes(map_to_analyse) *
- map_to_analyse->blocks_per_strip;
- } else {
- info->component_size = blocks_per_member(map_to_analyse);
- }
-
+ info->component_size = calc_component_size(map, dev);
info->component_size = imsm_component_size_aligment_check(
info->array.level,
info->array.chunk_size,
@@ -3381,7 +3418,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
used_disks = imsm_num_data_members(prev_map);
if (used_disks > 0) {
- array_blocks = blocks_per_member(map) *
+ array_blocks = per_dev_array_size(map) *
used_disks;
info->custom_array_size =
round_size_to_mb(array_blocks,
@@ -5383,9 +5420,6 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
vol->curr_migr_unit = 0;
map = get_imsm_map(dev, MAP_0);
set_pba_of_lba0(map, super->create_offset);
- set_blocks_per_member(map, info_to_blocks_per_member(info,
- size_per_member /
- BLOCKS_PER_KB));
map->blocks_per_strip = __cpu_to_le16(info_to_blocks_per_strip(info));
map->failed_disk_num = ~0;
if (info->level > 0)
@@ -5417,6 +5451,11 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
num_data_stripes /= map->num_domains;
set_num_data_stripes(map, num_data_stripes);
+ size_per_member += NUM_BLOCKS_DIRTY_STRIPE_REGION;
+ set_blocks_per_member(map, info_to_blocks_per_member(info,
+ size_per_member /
+ BLOCKS_PER_KB));
+
map->num_members = info->raid_disks;
for (i = 0; i < map->num_members; i++) {
/* initialized in add_to_super */
@@ -7821,18 +7860,14 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
info_d->events = __le32_to_cpu(mpb->generation_num);
info_d->data_offset = pba_of_lba0(map);
+ info_d->component_size = calc_component_size(map, dev);
if (map->raid_level == 5) {
- info_d->component_size =
- num_data_stripes(map) *
- map->blocks_per_strip;
info_d->ppl_sector = this->ppl_sector;
info_d->ppl_size = this->ppl_size;
if (this->consistency_policy == CONSISTENCY_POLICY_PPL &&
recovery_start == 0)
this->resync_start = 0;
- } else {
- info_d->component_size = blocks_per_member(map);
}
info_d->bb.supported = 1;
@@ -8156,7 +8191,7 @@ static unsigned long long imsm_set_array_size(struct imsm_dev *dev,
if (new_size <= 0)
/* OLCE size change is caused by added disks
*/
- array_blocks = blocks_per_member(map) * used_disks;
+ array_blocks = per_dev_array_size(map) * used_disks;
else
/* Online Volume Size Change
* Using available free space
@@ -8273,7 +8308,7 @@ static int imsm_set_array_state(struct active_array *a, int consistent)
used_disks = imsm_num_data_members(map);
if (used_disks > 0) {
array_blocks =
- blocks_per_member(map) *
+ per_dev_array_size(map) *
used_disks;
array_blocks =
round_size_to_mb(array_blocks,
@@ -8715,11 +8750,11 @@ static struct dl *imsm_add_spare(struct intel_super *super, int slot,
pos = 0;
array_start = pba_of_lba0(map);
array_end = array_start +
- blocks_per_member(map) - 1;
+ per_dev_array_size(map) - 1;
do {
/* check that we can start at pba_of_lba0 with
- * blocks_per_member of space
+ * num_data_stripes*blocks_per_stripe of space
*/
if (array_start >= pos && array_end < ex[j].start) {
found = 1;
@@ -9145,6 +9180,12 @@ static int apply_reshape_migration_update(struct imsm_update_reshape_migration *
set_num_data_stripes(map, num_data_stripes);
}
+ /* ensure blocks_per_member has valid value
+ */
+ set_blocks_per_member(map,
+ per_dev_array_size(map) +
+ NUM_BLOCKS_DIRTY_STRIPE_REGION);
+
/* add disk
*/
if (u->new_level != 5 || migr_map->raid_level != 0 ||
@@ -9211,15 +9252,21 @@ static int apply_size_change_update(struct imsm_update_size_change *u,
int used_disks = imsm_num_data_members(map);
unsigned long long blocks_per_member;
unsigned long long num_data_stripes;
+ unsigned long long new_size_per_disk;
+
+ if (used_disks == 0)
+ return 0;
/* calculate new size
*/
- blocks_per_member = u->new_size / used_disks;
- num_data_stripes = blocks_per_member /
+ new_size_per_disk = u->new_size / used_disks;
+ blocks_per_member = new_size_per_disk +
+ NUM_BLOCKS_DIRTY_STRIPE_REGION;
+ num_data_stripes = new_size_per_disk /
map->blocks_per_strip;
num_data_stripes /= map->num_domains;
dprintf("(size: %llu, blocks per member: %llu, num_data_stipes: %llu)\n",
- u->new_size, blocks_per_member,
+ u->new_size, new_size_per_disk,
num_data_stripes);
set_blocks_per_member(map, blocks_per_member);
set_num_data_stripes(map, num_data_stripes);
@@ -9476,7 +9523,7 @@ static int apply_takeover_update(struct imsm_update_takeover *u,
unsigned long long num_data_stripes;
map->num_domains = 1;
- num_data_stripes = blocks_per_member(map);
+ num_data_stripes = imsm_dev_size(dev) / 2;
num_data_stripes /= map->blocks_per_strip;
num_data_stripes /= map->num_domains;
set_num_data_stripes(map, num_data_stripes);
@@ -9692,7 +9739,7 @@ static void imsm_process_update(struct supertype *st,
new_map = get_imsm_map(&u->dev, MAP_0);
new_start = pba_of_lba0(new_map);
- new_end = new_start + blocks_per_member(new_map);
+ new_end = new_start + per_dev_array_size(new_map);
inf = get_disk_info(u);
/* handle activate_spare versus create race:
@@ -9703,7 +9750,7 @@ static void imsm_process_update(struct supertype *st,
dev = get_imsm_dev(super, i);
map = get_imsm_map(dev, MAP_0);
start = pba_of_lba0(map);
- end = start + blocks_per_member(map);
+ end = start + per_dev_array_size(map);
if ((new_start >= start && new_start <= end) ||
(start >= new_start && start <= new_end))
/* overlap */;
@@ -10492,7 +10539,7 @@ static struct md_bb *imsm_get_badblocks(struct active_array *a, int slot)
return NULL;
get_volume_badblocks(super->bbm_log, ord_to_idx(ord), pba_of_lba0(map),
- blocks_per_member(map), &super->bb);
+ per_dev_array_size(map), &super->bb);
return &super->bb;
}
--
2.7.4

View File

@ -1,57 +0,0 @@
From 54865c30d5b94920318950e29a4f6c1ce075cae8 Mon Sep 17 00:00:00 2001
From: Roman Sobanski <roman.sobanski@intel.com>
Date: Wed, 25 Apr 2018 11:25:06 +0200
Subject: [RHEL7.5 PATCH 08/26] Prevent create IMSM volume with size smaller
than 1M or chunk
Block creation of the imsm volume when given size is smaller than 1M and
print appropriate message.
Commit b53bfba6119d3f6f56eb9e10e5a59da6901af159
(imsm: use rounded size for metadata initialization) introduces issue with
rounding volume sizes smaller than 1M to 0. There is an inconsistency when
size smaller than 1M was given depends of what we give as target device:
1) When block devices was given created volume has maximum available size.
2) When container symlink was given created volume has size 0. Additionally
it causes below call trace:
[69587.891556] WARNING: CPU: 28 PID: 22485 at ../drivers/md/md.c:7582 md_seq_show+0x764/0x770 [md_mod]
[69588.066405] Call Trace:
[69588.066409] seq_read+0x336/0x430
[69588.066411] proc_reg_read+0x40/0x70
[69588.066412] __vfs_read+0x26/0x140
[69588.066414] vfs_read+0x89/0x130
[69588.066415] SyS_read+0x42/0x90
[69588.066417] do_syscall_64+0x74/0x140
[69588.066419] entry_SYSCALL_64_after_hwframe+0x3d/0xa2
Signed-off-by: Roman Sobanski <roman.sobanski@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
super-intel.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/super-intel.c b/super-intel.c
index c55c85f..520abf5 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -7358,6 +7358,16 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
verbose);
}
+ if (size && ((size < 1024) || (*chunk != UnSet &&
+ size < (unsigned long long) *chunk))) {
+ pr_err("Given size must be greater than 1M and chunk size.\n");
+ /* Depends on algorithm in Create.c :
+ * if container was given (dev == NULL) return -1,
+ * if block device was given ( dev != NULL) return 0.
+ */
+ return dev ? -1 : 0;
+ }
+
if (!dev) {
if (st->sb) {
struct intel_super *super = st->sb;
--
2.7.4

View File

@ -1,32 +0,0 @@
From 5d518de84e7cd3382b4984cc1243ddb4102aa4f4 Mon Sep 17 00:00:00 2001
From: Roman Sobanski <roman.sobanski@intel.com>
Date: Fri, 27 Apr 2018 12:12:21 +0200
Subject: [RHEL7.5 PATCH 09/26] mdadm/grow: correct size and chunk_size casting
With commit 4b74a905a67e
("mdadm/grow: Component size must be larger than chunk size") mdadm returns
incorrect message if size given to grow was greater than 2 147 483 647 K.
Cast chunk_size to "unsigned long long" instead of casting size to "int".
Signed-off-by: Roman Sobanski <roman.sobanski@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
Grow.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Grow.c b/Grow.c
index 8722969..a4be7e7 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1821,7 +1821,7 @@ int Grow_reshape(char *devname, int fd,
}
if (array.level > 1 && s->size > 1 &&
- (array.chunk_size / 1024) > (int)s->size) {
+ (unsigned long long) (array.chunk_size / 1024) > s->size) {
pr_err("component size must be larger than chunk size.\n");
return 1;
}
--
2.7.4

View File

@ -1,105 +0,0 @@
From 3e684231ebe10c08e7cf23743d4516f707e605a2 Mon Sep 17 00:00:00 2001
From: Michal Zylowski <michal.zylowski@intel.com>
Date: Tue, 29 May 2018 15:46:40 +0200
Subject: [RHEL7.5 PATCH 10/26] Fix misspelling of 'alignment' and 'geometry'
Set gemetry to geometry in error message about geometry validation failed.
Fix misspelled 'alignment' word in imsm_component_size_alignment_check
function.
Signed-off-by: Michal Zylowski <michal.zylowski@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
super-intel.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index 520abf5..ce08af4 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -3228,27 +3228,27 @@ int imsm_reshape_blocks_arrays_changes(struct intel_super *super)
}
return rv;
}
-static unsigned long long imsm_component_size_aligment_check(int level,
+static unsigned long long imsm_component_size_alignment_check(int level,
int chunk_size,
unsigned int sector_size,
unsigned long long component_size)
{
- unsigned int component_size_alligment;
+ unsigned int component_size_alignment;
- /* check component size aligment
+ /* check component size alignment
*/
- component_size_alligment = component_size % (chunk_size/sector_size);
+ component_size_alignment = component_size % (chunk_size/sector_size);
- dprintf("(Level: %i, chunk_size = %i, component_size = %llu), component_size_alligment = %u\n",
+ dprintf("(Level: %i, chunk_size = %i, component_size = %llu), component_size_alignment = %u\n",
level, chunk_size, component_size,
- component_size_alligment);
+ component_size_alignment);
- if (component_size_alligment && (level != 1) && (level != UnSet)) {
- dprintf("imsm: reported component size alligned from %llu ",
+ if (component_size_alignment && (level != 1) && (level != UnSet)) {
+ dprintf("imsm: reported component size aligned from %llu ",
component_size);
- component_size -= component_size_alligment;
+ component_size -= component_size_alignment;
dprintf_cont("to %llu (%i).\n",
- component_size, component_size_alligment);
+ component_size, component_size_alignment);
}
return component_size;
@@ -3351,7 +3351,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
info->data_offset = pba_of_lba0(map_to_analyse);
info->component_size = calc_component_size(map, dev);
- info->component_size = imsm_component_size_aligment_check(
+ info->component_size = imsm_component_size_alignment_check(
info->array.level,
info->array.chunk_size,
super->sector_size,
@@ -7089,7 +7089,7 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
mpb = super->anchor;
if (!validate_geometry_imsm_orom(super, level, layout, raiddisks, chunk, size, verbose)) {
- pr_err("RAID gemetry validation failed. Cannot proceed with the action(s).\n");
+ pr_err("RAID geometry validation failed. Cannot proceed with the action(s).\n");
return 0;
}
if (!dev) {
@@ -11434,7 +11434,7 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
if (geo->size > 0 && geo->size != MAX_SIZE) {
/* align component size
*/
- geo->size = imsm_component_size_aligment_check(
+ geo->size = imsm_component_size_alignment_check(
get_imsm_raid_level(dev->vol.map),
chunk * 1024, super->sector_size,
geo->size * 2);
@@ -11468,7 +11468,7 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
max_size = free_size + current_size;
/* align component size
*/
- max_size = imsm_component_size_aligment_check(
+ max_size = imsm_component_size_alignment_check(
get_imsm_raid_level(dev->vol.map),
chunk * 1024, super->sector_size,
max_size);
@@ -11970,7 +11970,7 @@ static int imsm_manage_reshape(
buf_size = __le32_to_cpu(migr_rec->blocks_per_unit) * 512;
/* extend buffer size for parity disk */
buf_size += __le32_to_cpu(migr_rec->dest_depth_per_unit) * 512;
- /* add space for stripe aligment */
+ /* add space for stripe alignment */
buf_size += old_data_stripe_length;
if (posix_memalign((void **)&buf, MAX_SECTOR_SIZE, buf_size)) {
dprintf("imsm: Cannot allocate checkpoint buffer\n");
--
2.7.4

View File

@ -1,42 +0,0 @@
From 760365f94409ccccbcb54d55070f0f422bee44a1 Mon Sep 17 00:00:00 2001
From: Jes Sorensen <jsorensen@fb.com>
Date: Tue, 29 May 2018 15:52:48 -0400
Subject: [RHEL7.5 PATCH 11/26] Do not confuse gcc
gcc-8.1's -Werror=stringop-truncation is easily confused. Rather than
disabling the check, make it explicit we are OK truncating here.
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
super-intel.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/super-intel.c b/super-intel.c
index ce08af4..449da1d 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -5323,6 +5323,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
struct imsm_map *map;
int idx = mpb->num_raid_devs;
int i;
+ int namelen;
unsigned long long array_blocks;
size_t size_old, size_new;
unsigned long long num_data_stripes;
@@ -5402,7 +5403,12 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
return 0;
dv = xmalloc(sizeof(*dv));
dev = xcalloc(1, sizeof(*dev) + sizeof(__u32) * (info->raid_disks - 1));
- strncpy((char *) dev->volume, name, MAX_RAID_SERIAL_LEN);
+ /*
+ * Explicitly allow truncating to not confuse gcc's
+ * -Werror=stringop-truncation
+ */
+ namelen = min((int) strlen(name), MAX_RAID_SERIAL_LEN);
+ memcpy(dev->volume, name, namelen);
array_blocks = calc_array_size(info->level, info->raid_disks,
info->layout, info->chunk_size,
s->size * BLOCKS_PER_KB);
--
2.7.4

View File

@ -1,31 +0,0 @@
From 167d8bb8302170676f0e15123738e333383fec7b Mon Sep 17 00:00:00 2001
From: Jes Sorensen <jsorensen@fb.com>
Date: Tue, 29 May 2018 16:09:47 -0400
Subject: [RHEL7.5 PATCH 12/26] super-intel: Use memcpy() to avoid confusing
gcc
When added :0 to serial number and copying it back, use memcpy()
instead of strncpy() as we know the actual length. This stops gcc
from complaining with -Werror=stringop-truncation enabled
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
super-intel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/super-intel.c b/super-intel.c
index 449da1d..ec7683d 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -8098,7 +8098,7 @@ static int mark_failure(struct intel_super *super,
strcat(buf, ":0");
if ((len = strlen(buf)) >= MAX_RAID_SERIAL_LEN)
shift = len - MAX_RAID_SERIAL_LEN + 1;
- strncpy((char *)disk->serial, &buf[shift], MAX_RAID_SERIAL_LEN);
+ memcpy(disk->serial, &buf[shift], len + 1 - shift);
disk->status |= FAILED_DISK;
set_imsm_ord_tbl_ent(map, slot, idx | IMSM_ORD_REBUILD);
--
2.7.4

View File

@ -1,27 +0,0 @@
From 1cdc06dfda62775647b81e2753fc7908e1bbffc2 Mon Sep 17 00:00:00 2001
From: Jes Sorensen <jsorensen@fb.com>
Date: Tue, 29 May 2018 16:55:41 -0400
Subject: [RHEL7.5 PATCH 13/26] super-intel: Get rid of unnused string
No need to snprintf() into the string when we don't use it afterards
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
super-intel.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/super-intel.c b/super-intel.c
index ec7683d..cc53f0f 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -1928,7 +1928,6 @@ static void examine_super_imsm(struct supertype *st, char *homehost)
strncpy(str, (char *)mpb->sig, MPB_SIG_LEN);
str[MPB_SIG_LEN-1] = '\0';
printf(" Magic : %s\n", str);
- snprintf(str, strlen(MPB_VERSION_RAID0), "%s", get_imsm_version(mpb));
printf(" Version : %s\n", get_imsm_version(mpb));
printf(" Orig Family : %08x\n", __le32_to_cpu(mpb->orig_family_num));
printf(" Family : %08x\n", __le32_to_cpu(mpb->family_num));
--
2.7.4

View File

@ -1,38 +0,0 @@
From 40659392ff90fc9c2861ec18c34ed1bdb54f92ca Mon Sep 17 00:00:00 2001
From: Jes Sorensen <jsorensen@fb.com>
Date: Wed, 30 May 2018 11:56:37 -0400
Subject: [RHEL7.5 PATCH 14/26] super-intel: Avoid gcc-8.1 complaining about
truncating snprintf()
We know the max size of the volume name, so no need to play the
snprintf() game.
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
super-intel.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/super-intel.c b/super-intel.c
index cc53f0f..520d292 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -9881,6 +9881,7 @@ static void imsm_process_update(struct supertype *st,
/* sanity check that we are not affecting the uuid of
* an active array
*/
+ memset(name, 0, sizeof(name));
snprintf(name, MAX_RAID_SERIAL_LEN, "%s", (char *) u->name);
name[MAX_RAID_SERIAL_LEN] = '\0';
for (a = st->arrays; a; a = a->next)
@@ -9892,7 +9893,7 @@ static void imsm_process_update(struct supertype *st,
break;
}
- snprintf((char *) dev->volume, MAX_RAID_SERIAL_LEN, "%s", name);
+ memcpy(dev->volume, name, MAX_RAID_SERIAL_LEN);
super->updates_pending++;
break;
}
--
2.7.4

View File

@ -1,37 +0,0 @@
From ebad3af29b401dec7203e8fa5a77bcf16532f49c Mon Sep 17 00:00:00 2001
From: Jes Sorensen <jsorensen@fb.com>
Date: Wed, 30 May 2018 12:10:13 -0400
Subject: [RHEL7.5 PATCH 15/26] super-intel: Do not truncate last character of
volume name
Clear up strncpy abuse to avoid gcc-8.1 complaining about truncating
the string.
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
super-intel.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index 520d292..aa93a9e 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -7587,11 +7587,12 @@ static int update_subarray_imsm(struct supertype *st, char *subarray,
append_metadata_update(st, u, sizeof(*u));
} else {
struct imsm_dev *dev;
- int i;
+ int i, namelen;
dev = get_imsm_dev(super, vol);
- strncpy((char *) dev->volume, name, MAX_RAID_SERIAL_LEN);
- dev->volume[MAX_RAID_SERIAL_LEN-1] = '\0';
+ memset(dev->volume, '\0', MAX_RAID_SERIAL_LEN);
+ namelen = min((int)strlen(name), MAX_RAID_SERIAL_LEN);
+ memcpy(dev->volume, name, namelen);
for (i = 0; i < mpb->num_raid_devs; i++) {
dev = get_imsm_dev(super, i);
handle_missing(super, dev);
--
2.7.4

View File

@ -1,36 +0,0 @@
From 59632db96bdd09b44e9927f63a67cccbe8b15cdf Mon Sep 17 00:00:00 2001
From: Michal Zylowski <michal.zylowski@intel.com>
Date: Tue, 29 May 2018 15:47:09 +0200
Subject: [RHEL7.5 PATCH 16/26] imsm: Do not block volume creation when
container has disks with mixed sector size
Currently when created container keeps disks with mixed sector size (few
4K disks and some 512 disks) there is no possibility to create volume from
disks with one sector size.
Allow volume creation when given disks are related with mixed container.
Signed-off-by: Michal Zylowski <michal.zylowski@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
super-intel.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/super-intel.c b/super-intel.c
index aa93a9e..12f60f6 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -5616,6 +5616,11 @@ static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk,
return 1;
}
+ if (mpb->num_disks == 0)
+ if (!get_dev_sector_size(dl->fd, dl->devname,
+ &super->sector_size))
+ return 1;
+
if (!drive_validate_sector_size(super, dl)) {
pr_err("Combining drives of different sector size in one volume is not allowed\n");
return 1;
--
2.7.4

View File

@ -1,125 +0,0 @@
From 5a5b3a6725ded07697f03ddd05ee537ce289e951 Mon Sep 17 00:00:00 2001
From: Michal Zylowski <michal.zylowski@intel.com>
Date: Tue, 29 May 2018 15:47:25 +0200
Subject: [RHEL7.5 PATCH 17/26] imsm: Do not require MDADM_EXPERIMENTAL flag
anymore
Grow feature for IMSM metadata is currently fully supported and tested.
Reshape operation is not in experimental state anymore, so usage of this
flag is unnecessary.
Do not require MDADM_EXPERIMENTAL flag and remove obsolete information
from manual.
Signed-off-by: Michal Zylowski <michal.zylowski@intel.com>
Acked-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
Acked-by: Roman Sobanski <roman.sobanski@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
mdadm.8.in | 24 ++++++------------------
mdadm.h | 1 -
super-intel.c | 3 ---
tests/env-imsm-template | 1 -
util.c | 10 ----------
5 files changed, 6 insertions(+), 33 deletions(-)
diff --git a/mdadm.8.in b/mdadm.8.in
index ea45bbc..d6bb3fa 100644
--- a/mdadm.8.in
+++ b/mdadm.8.in
@@ -2718,27 +2718,15 @@ above. Resizing arrays in an IMSM container with
.B "--grow --size"
is not yet supported.
-Grow functionality (e.g. expand a number of raid devices) for Intel's
-IMSM container format has an experimental status. It is guarded by the
-.B MDADM_EXPERIMENTAL
-environment variable which must be set to '1' for a GROW command to
-succeed.
-This is for the following reasons:
-
-.IP 1.
-Intel's native IMSM check-pointing is not fully tested yet.
-This can causes IMSM incompatibility during the grow process: an array
-which is growing cannot roam between Microsoft Windows(R) and Linux
-systems.
-
-.IP 2.
-Interrupting a grow operation is not recommended, because it
-has not been fully tested for Intel's IMSM container format yet.
-
.PP
-Note: Intel's native checkpointing doesn't use
+Notes:
+.IP \(bu 4
+Intel's native checkpointing doesn't use
.B --backup-file
option and it is transparent for assembly feature.
+.IP \(bu 4
+Roaming between Windows(R) and Linux systems for IMSM metadata is not
+supported during grow process.
.SS SIZE CHANGES
Normally when an array is built the "size" is taken from the smallest
diff --git a/mdadm.h b/mdadm.h
index 61bc7af..387e681 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -1485,7 +1485,6 @@ extern struct mddev_ident *conf_match(struct supertype *st,
struct mdinfo *info,
char *devname,
int verbose, int *rvp);
-extern int experimental(void);
extern void free_line(char *line);
extern int match_oneof(char *devices, char *devname);
diff --git a/super-intel.c b/super-intel.c
index 12f60f6..a01be13 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -11607,9 +11607,6 @@ static int imsm_reshape_super(struct supertype *st, unsigned long long size,
dprintf("for level : %i\n", geo.level);
dprintf("for raid_disks : %i\n", geo.raid_disks);
- if (experimental() == 0)
- return ret_val;
-
if (strcmp(st->container_devnm, st->devnm) == 0) {
/* On container level we can only increase number of devices. */
dprintf("imsm: info: Container operation\n");
diff --git a/tests/env-imsm-template b/tests/env-imsm-template
index bc5f585..ea45bae 100644
--- a/tests/env-imsm-template
+++ b/tests/env-imsm-template
@@ -65,7 +65,6 @@ imsm_check() {
export IMSM_NO_PLATFORM=1
export IMSM_DEVNAME_AS_SERIAL=1
export IMSM_TEST_OROM=1
-export MDADM_EXPERIMENTAL=1
container=/dev/md/container
member0=/dev/md/vol0
member1=/dev/md/vol1
diff --git a/util.c b/util.c
index 4adbbff..c26cf5f 100644
--- a/util.c
+++ b/util.c
@@ -2149,16 +2149,6 @@ void append_metadata_update(struct supertype *st, void *buf, int len)
unsigned int __invalid_size_argument_for_IOC = 0;
#endif
-int experimental(void)
-{
- if (check_env("MDADM_EXPERIMENTAL"))
- return 1;
- else {
- pr_err("To use this feature MDADM_EXPERIMENTAL environment variable has to be defined.\n");
- return 0;
- }
-}
-
/* Pick all spares matching given criteria from a container
* if min_size == 0 do not check size
* if domlist == NULL do not check domains
--
2.7.4

View File

@ -1,31 +0,0 @@
From 975898395951835f5a8051441af21cc995921f8c Mon Sep 17 00:00:00 2001
From: Jes Sorensen <jsorensen@fb.com>
Date: Thu, 31 May 2018 11:45:21 -0400
Subject: [RHEL7.5 PATCH 18/26] Monitor: Increase size of percentalert to avoid
gcc warning
gcc-8.1 complains about truncated string operations. While we know
percent will never grow larger than 100, it doesn't cost us anything
to increase the size of 'percentalert' on the stack like this.
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
Monitor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Monitor.c b/Monitor.c
index c7c05d2..036103f 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -557,7 +557,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
alert("RebuildStarted", dev, NULL, ainfo);
if (st->percent >= 0 && mse->percent >= 0 &&
(mse->percent / increments) > (st->percent / increments)) {
- char percentalert[15];
+ char percentalert[18];
/*
* "RebuildNN" (10 chars) or "RebuildStarted" (15 chars)
*/
--
2.7.4

View File

@ -1,42 +0,0 @@
From c1b78589cf042221e22a014332b195b2309cb178 Mon Sep 17 00:00:00 2001
From: Jes Sorensen <jsorensen@fb.com>
Date: Thu, 31 May 2018 13:11:21 -0400
Subject: [RHEL7.5 PATCH 19/26] mdopen: fix gcc 8.1 string overflow error
We already cut symlinks longer than 1000, so rely on this calling
readlink and error out if we are able to read more than 1000 bytes.
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
mdopen.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/mdopen.c b/mdopen.c
index 4ec13f5..98c54e4 100644
--- a/mdopen.c
+++ b/mdopen.c
@@ -44,7 +44,7 @@ void make_parts(char *dev, int cnt)
int nlen = strlen(dev) + 20;
char *name;
int dig = isdigit(dev[strlen(dev)-1]);
- char orig[1024];
+ char orig[1001];
char sym[1024];
int err;
@@ -58,8 +58,10 @@ void make_parts(char *dev, int cnt)
minor_num = minor(stb.st_rdev);
odig = -1;
} else if (S_ISLNK(stb.st_mode)) {
- int len = readlink(dev, orig, sizeof(orig));
- if (len < 0 || len > 1000)
+ int len;
+
+ len = readlink(dev, orig, sizeof(orig));
+ if (len < 0 || len >= (int)sizeof(orig))
return;
orig[len] = 0;
odig = isdigit(orig[len-1]);
--
2.7.4

View File

@ -1,34 +0,0 @@
From 2dcd6492718c2921feac993aa71ed3a7c2522077 Mon Sep 17 00:00:00 2001
From: Jes Sorensen <jsorensen@fb.com>
Date: Thu, 31 May 2018 13:17:46 -0400
Subject: [RHEL7.5 PATCH 20/26] super0: Use memmove() when adjusting sparc2.2
superblock data
memcpy() does not allow overlapping copies, switch to memmove()
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
super0.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/super0.c b/super0.c
index 756cab5..42989b9 100644
--- a/super0.c
+++ b/super0.c
@@ -520,9 +520,10 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
* up 4 bytes before continuing
*/
__u32 *sb32 = (__u32*)sb;
- memcpy(sb32+MD_SB_GENERIC_CONSTANT_WORDS+7,
- sb32+MD_SB_GENERIC_CONSTANT_WORDS+7+1,
- (MD_SB_WORDS - (MD_SB_GENERIC_CONSTANT_WORDS+7+1))*4);
+
+ memmove(sb32+MD_SB_GENERIC_CONSTANT_WORDS+7,
+ sb32+MD_SB_GENERIC_CONSTANT_WORDS+7+1,
+ (MD_SB_WORDS - (MD_SB_GENERIC_CONSTANT_WORDS+7+1))*4);
if (verbose >= 0)
pr_err("adjusting superblock of %s for 2.2/sparc compatibility.\n",
devname);
--
2.7.4

View File

@ -1,57 +0,0 @@
From 4d061b02b61d5e6d4186e0118166fdd40ea8b55f Mon Sep 17 00:00:00 2001
From: Jes Sorensen <jsorensen@fb.com>
Date: Thu, 31 May 2018 13:38:08 -0400
Subject: [RHEL7.5 PATCH 21/26] super1: Fix cases triggering gcc-8.1 strncpy
truncate warning
Find the string length, copy it, and zero out the rest, instead of
relying on strncpy cleaning up for us.
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
super1.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/super1.c b/super1.c
index 6774fbd..636a286 100644
--- a/super1.c
+++ b/super1.c
@@ -1434,8 +1434,15 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
strcpy(sb->set_name, homehost);
strcat(sb->set_name, ":");
strcat(sb->set_name, info->name);
- } else
- strncpy(sb->set_name, info->name, sizeof(sb->set_name));
+ } else {
+ int namelen;
+
+ namelen = min((int)strlen(info->name),
+ (int)sizeof(sb->set_name) - 1);
+ memcpy(sb->set_name, info->name, namelen);
+ memset(&sb->set_name[namelen], '\0',
+ sizeof(sb->set_name) - namelen);
+ }
} else if (strcmp(update, "devicesize") == 0 &&
__le64_to_cpu(sb->super_offset) <
__le64_to_cpu(sb->data_offset)) {
@@ -1592,8 +1599,15 @@ static int init_super1(struct supertype *st, mdu_array_info_t *info,
strcpy(sb->set_name, homehost);
strcat(sb->set_name, ":");
strcat(sb->set_name, name);
- } else
- strncpy(sb->set_name, name, sizeof(sb->set_name));
+ } else {
+ int namelen;
+
+ namelen = min((int)strlen(name),
+ (int)sizeof(sb->set_name) - 1);
+ memcpy(sb->set_name, name, namelen);
+ memset(&sb->set_name[namelen], '\0',
+ sizeof(sb->set_name) - namelen);
+ }
sb->ctime = __cpu_to_le64((unsigned long long)time(0));
sb->level = __cpu_to_le32(info->level);
--
2.7.4

View File

@ -1,32 +0,0 @@
From 002a5978f015a77ecc48487006b1030f9dbe1394 Mon Sep 17 00:00:00 2001
From: Jes Sorensen <jsorensen@fb.com>
Date: Thu, 31 May 2018 16:07:33 -0400
Subject: [RHEL7.5 PATCH 22/26] super-ddf: Fix gcc-8.1 overflow warnings
Cast to types that are big enough to hold the values, but also guarantee
no overflow of the buffer keepts gcc happy.
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
super-ddf.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/super-ddf.c b/super-ddf.c
index d02a19a..618542c 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -2881,8 +2881,9 @@ static int add_to_super_ddf(struct supertype *st,
dd->disk.magic = DDF_PHYS_DATA_MAGIC;
now = time(0);
tm = localtime(&now);
- sprintf(dd->disk.guid, "%8s%04d%02d%02d",
- T10, tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday);
+ sprintf(dd->disk.guid, "%8s%04d%02d%02d", T10,
+ (__u16)tm->tm_year+1900,
+ (__u8)tm->tm_mon+1, (__u8)tm->tm_mday);
tptr = (__u32 *)(dd->disk.guid + 16);
*tptr++ = random32();
*tptr = random32();
--
2.7.4

View File

@ -1,48 +0,0 @@
From 27e39ad31cbdfe516f9f390cc860a4f681750ef0 Mon Sep 17 00:00:00 2001
From: Xiao Ni <xni@redhat.com>
Date: Wed, 30 May 2018 13:49:41 +0800
Subject: [RHEL7.5 PATCH 23/26] Check major number of block device when
querying md device
It give error message when query a non md device.
mdadm /dev/null
/dev/null: is an md device, but gives "Inappropriate ioctl for device" when queried
It's introduced by commit 5cb8599 and 8d0cd09
At first it checks whether a block is md device by function md_get_version.
In this function it does mainly two jobs:
1. send request by ioctl. (now it can be replace by argument ioctlerr)
2. check the block device major number which we don't do this.
We add the second judgement in this patch.
Fixes: 5cb8599 and 8d0cd09
Reported-by: Karsten Weiss <karsten.weiss@atos.net>
Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
Query.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/Query.c b/Query.c
index 2bd0e2a..23fbf8a 100644
--- a/Query.c
+++ b/Query.c
@@ -85,12 +85,11 @@ int Query(char *dev)
if (ioctlerr == ENODEV)
printf("%s: is an md device which is not active\n", dev);
+ else if (ioctlerr && major(stb.st_rdev) != MD_MAJOR)
+ printf("%s: is not an md array\n", dev);
else if (ioctlerr)
printf("%s: is an md device, but gives \"%s\" when queried\n",
dev, strerror(ioctlerr));
- else if (staterr)
- printf("%s: is not a valid md device, returning %s\n",
- dev, strerror(ioctlerr));
else {
printf("%s: %s %s %d devices, %d spare%s. Use mdadm --detail for more detail.\n",
dev, human_size_brief(larray_size,IEC),
--
2.7.4

View File

@ -1,54 +0,0 @@
From 38e955cbf030bc9e564bd87bc9f02f949884a83f Mon Sep 17 00:00:00 2001
From: Zhilong Liu <zlliu@suse.com>
Date: Wed, 30 May 2018 15:04:05 +0800
Subject: [RHEL7.5 PATCH 24/26] mdadm/test: mdadm needn't make install on the
system
Fixes: beb71de04d31 ("mdadm/test: enable clustermd testing under clustermd_tests/")
clustermd_tests/func.sh:
remove unnecessary 'make install', just ensure 'make everything' has done.
the original idea is to make the /sbin/mdadm version same as ./mdadm, and
this breakage has pointed out by commit:
59416da78fc6 ("tests/func.sh: Fix some total breakage in the test scripts")
Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
clustermd_tests/func.sh | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/clustermd_tests/func.sh b/clustermd_tests/func.sh
index c2be0e5..642cc96 100644
--- a/clustermd_tests/func.sh
+++ b/clustermd_tests/func.sh
@@ -86,10 +86,13 @@ check_env()
echo "testing can only be done as 'root'."
exit 1
}
+ [ \! -x $mdadm ] && {
+ echo "test: please run make everything before perform testing."
+ exit 1
+ }
check_ssh
commands=(mdadm iscsiadm bc modinfo dlm_controld
udevadm crm crm_mon lsblk pgrep sbd)
- mdadm_src_ver="$($mdadm -V 2>&1)"
for ip in $NODE1 $NODE2
do
for cmd in ${commands[@]}
@@ -99,12 +102,6 @@ check_env()
exit 1
}
done
- mdadm_sbin_ver="$(ssh $ip "mdadm -V 2>&1")"
- if [ "$mdadm_src_ver" != "$mdadm_sbin_ver" ]
- then
- echo "$ip: please run 'make install' before testing."
- exit 1
- fi
mods=(raid1 raid10 md_mod dlm md-cluster)
for mod in ${mods[@]}
do
--
2.7.4

View File

@ -1,30 +0,0 @@
From 7d4815f84cba133ee7439db5348ce554779f8342 Mon Sep 17 00:00:00 2001
From: Zhilong Liu <zlliu@suse.com>
Date: Wed, 30 May 2018 15:04:41 +0800
Subject: [RHEL7.5 PATCH 25/26] mdadm/test: correct tests/testdev as testdev in
02r5grow
Fixes: a6994ccc230b ("mdadm/test: get rid of the tests/testdev")
Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
tests/02r5grow | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/02r5grow b/tests/02r5grow
index bb9bd6d..2da78ee 100644
--- a/tests/02r5grow
+++ b/tests/02r5grow
@@ -31,7 +31,7 @@ testdev $md0 3 $[mdsize1_l] 128
mdadm --grow $md0 --size $[size/2]
check nosync
-sh tests/testdev $md0 3 $[size/2] 128
+testdev $md0 3 $[size/2] 128
mdadm -S $md0
--
2.7.4

View File

@ -1,74 +0,0 @@
From 28156667e5c7dc3c7b978f2d58c2a427038fedda Mon Sep 17 00:00:00 2001
From: Jes Sorensen <jsorensen@fb.com>
Date: Mon, 4 Jun 2018 14:49:59 -0400
Subject: [RHEL7.5 PATCH 26/26] gcc-8 coverity hack
Coverity still has issues with gcc-7, not to mention gcc-8. Hack around
it, until they fix it.
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
Makefile | 15 +++++++++++----
coverity-gcc-hack.h | 10 ++++++++++
2 files changed, 21 insertions(+), 4 deletions(-)
create mode 100644 coverity-gcc-hack.h
diff --git a/Makefile b/Makefile
index 188a218..2767ac6 100644
--- a/Makefile
+++ b/Makefile
@@ -42,6 +42,10 @@ KLIBC=/home/src/klibc/klibc-0.77
KLIBC_GCC = gcc -nostdinc -iwithprefix include -I$(KLIBC)/klibc/include -I$(KLIBC)/linux/include -I$(KLIBC)/klibc/arch/i386/include -I$(KLIBC)/klibc/include/bits32
+ifdef COVERITY
+COVERITY_FLAGS=-include coverity-gcc-hack.h
+endif
+
CC ?= $(CROSS_COMPILE)gcc
CXFLAGS ?= -ggdb
CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter
@@ -177,6 +181,9 @@ everything-test: all mdadm.static swap_super test_stripe \
# mdadm.uclibc doesn't work on x86-64
# mdadm.tcc doesn't work..
+%.o: %.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) $(COVERITY_FLAGS) -o $@ -c $<
+
mdadm : $(OBJS) | check_rundir
$(CC) $(CFLAGS) $(LDFLAGS) -o mdadm $(OBJS) $(LDLIBS)
@@ -291,10 +298,10 @@ test: mdadm mdmon test_stripe swap_super raid6check
clean :
rm -f mdadm mdmon $(OBJS) $(MON_OBJS) $(STATICOBJS) core *.man \
- mdadm.tcc mdadm.uclibc mdadm.static *.orig *.porig *.rej *.alt .merge_file_* \
- mdadm.Os mdadm.O2 mdmon.O2 swap_super \
- init.cpio.gz mdadm.uclibc.static test_stripe raid6check raid6check.o mdmon \
- mdadm.8
+ mdadm.tcc mdadm.uclibc mdadm.static *.orig *.porig *.rej *.alt \
+ .merge_file_* mdadm.Os mdadm.O2 mdmon.O2 swap_super init.cpio.gz \
+ mdadm.uclibc.static test_stripe raid6check raid6check.o mdmon mdadm.8
+ rm -rf cov-int
dist : clean
./makedist
diff --git a/coverity-gcc-hack.h b/coverity-gcc-hack.h
new file mode 100644
index 0000000..2d94a8b
--- /dev/null
+++ b/coverity-gcc-hack.h
@@ -0,0 +1,10 @@
+#if !defined(__KERNEL__) && defined(__x86_64__) && defined(__COVERITY_GCC_VERSION_AT_LEAST)
+#if __COVERITY_GCC_VERSION_AT_LEAST(7, 0)
+typedef float _Float128 __attribute__((__vector_size__(128)));
+typedef float _Float64 __attribute__((__vector_size__(64)));
+typedef float _Float32 __attribute__((__vector_size__(32)));
+typedef float _Float128x __attribute__((__vector_size__(128)));
+typedef float _Float64x __attribute__((__vector_size__(64)));
+typedef float _Float32x __attribute__((__vector_size__(32)));
+#endif
+#endif
--
2.7.4

View File

@ -1,7 +1,7 @@
Name: mdadm Name: mdadm
Version: 4.1 Version: 4.1
%define subversion rc1 %define subversion rc2
Release: rc1_1%{?dist}.2 Release: rc2.0.1%{?dist}
Summary: The mdadm program controls Linux md devices (software RAID arrays) Summary: The mdadm program controls Linux md devices (software RAID arrays)
URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/ URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/
License: GPLv2+ License: GPLv2+
@ -16,33 +16,6 @@ Source6: mdmonitor.service
Source7: mdadm.conf Source7: mdadm.conf
Source8: mdadm_event.conf Source8: mdadm_event.conf
Patch1: 0001-mdadm-fix-use-after-free-after-free_mdstat.patch
Patch2: 0002-imsm-Allow-create-RAID-volume-with-link-to-container.patch
Patch3: 0003-tests-func.sh-Fix-some-total-breakage-in-the-test-sc.patch
Patch4: 0004-imsm-change-reserved-space-to-4MB.patch
Patch5: 0005-imsm-add-functions-to-get-and-set-imsm-dev-size.patch
Patch6: 0006-imsm-pass-already-existing-map-to-imsm_num_data_memb.patch
Patch7: 0007-imsm-do-not-use-blocks_per_member-in-array-size-calc.patch
Patch8: 0008-Prevent-create-IMSM-volume-with-size-smaller-than-1M.patch
Patch9: 0009-mdadm-grow-correct-size-and-chunk_size-casting.patch
Patch10: 0010-Fix-misspelling-of-alignment-and-geometry.patch
Patch11: 0011-Do-not-confuse-gcc.patch
Patch12: 0012-super-intel-Use-memcpy-to-avoid-confusing-gcc.patch
Patch13: 0013-super-intel-Get-rid-of-unnused-string.patch
Patch14: 0014-super-intel-Avoid-gcc-8.1-complaining-about-truncati.patch
Patch15: 0015-super-intel-Do-not-truncate-last-character-of-volume.patch
Patch16: 0016-imsm-Do-not-block-volume-creation-when-container-has.patch
Patch17: 0017-imsm-Do-not-require-MDADM_EXPERIMENTAL-flag-anymore.patch
Patch18: 0018-Monitor-Increase-size-of-percentalert-to-avoid-gcc-w.patch
Patch19: 0019-mdopen-fix-gcc-8.1-string-overflow-error.patch
Patch20: 0020-super0-Use-memmove-when-adjusting-sparc2.2-superbloc.patch
Patch21: 0021-super1-Fix-cases-triggering-gcc-8.1-strncpy-truncate.patch
Patch22: 0022-super-ddf-Fix-gcc-8.1-overflow-warnings.patch
Patch23: 0023-Check-major-number-of-block-device-when-querying-md-.patch
Patch24: 0024-mdadm-test-mdadm-needn-t-make-install-on-the-system.patch
Patch25: 0025-mdadm-test-correct-tests-testdev-as-testdev-in-02r5g.patch
Patch26: 0026-gcc-8-coverity-hack.patch
# Fedora customization patches # Fedora customization patches
Patch97: mdadm-3.3-udev.patch Patch97: mdadm-3.3-udev.patch
Patch98: mdadm-2.5.2-static.patch Patch98: mdadm-2.5.2-static.patch
@ -65,33 +38,6 @@ file can be used to help with some common tasks.
%prep %prep
%setup -q -n %{name}-%{version}_%{subversion} %setup -q -n %{name}-%{version}_%{subversion}
%patch1 -p1 -b .0001
%patch2 -p1 -b .0002
%patch3 -p1 -b .0003
%patch4 -p1 -b .0004
%patch5 -p1 -b .0005
%patch6 -p1 -b .0006
%patch7 -p1 -b .0007
%patch8 -p1 -b .0008
%patch9 -p1 -b .0009
%patch10 -p1 -b .0010
%patch11 -p1 -b .0011
%patch12 -p1 -b .0012
%patch13 -p1 -b .0013
%patch14 -p1 -b .0014
%patch15 -p1 -b .0015
%patch16 -p1 -b .0016
%patch17 -p1 -b .0017
%patch18 -p1 -b .0018
%patch19 -p1 -b .0019
%patch20 -p1 -b .0020
%patch21 -p1 -b .0021
%patch22 -p1 -b .0022
%patch23 -p1 -b .0023
%patch24 -p1 -b .0024
%patch25 -p1 -b .0025
%patch26 -p1 -b .0026
# Fedora customization patches # Fedora customization patches
%patch97 -p1 -b .udev %patch97 -p1 -b .udev
%patch98 -p1 -b .static %patch98 -p1 -b .static
@ -146,6 +92,9 @@ install -m644 %{SOURCE8} %{buildroot}/etc/libreport/events.d
/etc/libreport/events.d/* /etc/libreport/events.d/*
%changelog %changelog
* Sun Aug 26 2018 Peter Robinson <pbrobinson@fedoraproject.org> 4.1-rc2.0.1
- Update to 4.1 rc2
* Fri Jul 20 2018 Xiao Ni <xni@redhat.com> - 4.1-rc1_1.2 * Fri Jul 20 2018 Xiao Ni <xni@redhat.com> - 4.1-rc1_1.2
- Add gcc into BuildRequires - Add gcc into BuildRequires
- Resolves bz1604811 - Resolves bz1604811

View File

@ -1 +1 @@
SHA512 (mdadm-4.1-rc1.tar.xz) = 07d75ba511a252de95356bc63e480b3c196ad0715d719f75599d1fa2995d649ea86a63f74aee7558316d728ebaae2c87d86806089cba735532e1c39641baf727 SHA512 (mdadm-4.1-rc2.tar.xz) = f4c9dc2961ccdf00f082be493525a3814ddd831e9aa67bfb4a4128c74b7887948adec85781dda795cf18d8bfd3df4d5bb01584e7f85435c96caf4111e806bc13