Avoid resync progress getting lost during expansion of IMSM metadata RAID1/5

Resolves bz948745

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
This commit is contained in:
Jes Sorensen 2013-04-23 12:31:42 +02:00
parent 2f8071afbc
commit adb522038d
2 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,49 @@
From 4edb8530e889fc7b5e1b5471a0fbfd6c3c116b4a Mon Sep 17 00:00:00 2001
From: Pawel Baldysiak <pawel.baldysiak@intel.com>
Date: Wed, 3 Apr 2013 12:43:42 +1100
Subject: [PATCH] Add updating component_size to manager thread of mdmon
Mdmon does not update component_size now. It is wrong because in case
of size's expansion component_size is changed by mdadm but mdmon does not
reread its new value and uses a wrong, old one. As a result the metadata
is incorrect during size's expansion. It contains no information that
resync is in progress (there is no checkpoint too). The metadata is
as if resync has already been finished but it has not.
Component_size will be set to match information in sysfs. This value
will be updated by manager thread in manage_member() function.
Now mdmon uses the correct, current value of component_size and the
correct metadata (containing information about resync and checkpoint)
is written.
Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
managemon.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/managemon.c b/managemon.c
index d155b04..2c55b3c 100644
--- a/managemon.c
+++ b/managemon.c
@@ -444,6 +444,7 @@ static void manage_member(struct mdstat_ent *mdstat,
char buf[64];
int frozen;
struct supertype *container = a->container;
+ unsigned long long int component_size = 0;
if (container == NULL)
/* Raced with something */
@@ -453,6 +454,9 @@ static void manage_member(struct mdstat_ent *mdstat,
a->info.array.raid_disks = mdstat->raid_disks;
// MORE
+ if (sysfs_get_ll(&a->info, NULL, "component_size", &component_size) >= 0)
+ a->info.component_size = component_size << 1;
+
/* honor 'frozen' */
if (sysfs_get_str(&a->info, NULL, "metadata_version", buf, sizeof(buf)) > 0)
frozen = buf[9] == '-';
--
1.8.1.4

View File

@ -1,7 +1,7 @@
Summary: The mdadm program controls Linux md devices (software RAID arrays)
Name: mdadm
Version: 3.2.6
Release: 17%{?dist}
Release: 18%{?dist}
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz
Source1: mdmonitor.init
Source2: raid-check
@ -14,6 +14,7 @@ Source8: mdadm_event.conf
Patch1: mdadm-3.2.6-Create.c-check-if-freesize-is-equal-0.patch
Patch2: mdadm-3.2.6-imsm-Forbid-spanning-between-multiple-controllers.patch
Patch3: mdadm-3.2.6-query-udev-dir-via-pkg-config.patch
Patch4: mdadm-3.2.6-Add-updating-component_size-to-manager-thread-of-mdm.patch
Patch93: mdadm-3.2.6-Remove-offroot-argument-and-default-to-always-settin.patch
Patch94: mdadm-3.2.6-Add-support-for-launching-mdmon-via-systemctl-instea.patch
Patch95: mdadm-3.2.6-In-case-launching-mdmon-fails-print-an-error-message.patch
@ -75,6 +76,7 @@ is not used as the system init process.
%patch1 -p1 -b .raidsize
%patch2 -p1 -b .multictrl
%patch3 -p1 -b .udevquery
%patch4 -p1 -b .component
# Use systemctl to launch mdmon on F18 and higher
%if !%{fedora17}
@ -166,6 +168,11 @@ rm -rf %{buildroot}
%endif
%changelog
* Wed Apr 23 2013 Jes Sorensen <Jes.Sorensen@redhat.com> - 3.2.6-18
- Fix problem with IMSM metadata where resync progress would be lost
if an array was stopped during ongoing expansion of a RAID1/5 volume.
- Resolves bz948745
* Wed Apr 23 2013 Jes Sorensen <Jes.Sorensen@redhat.com> - 3.2.6-17
- Reorder patches to allow for udev query patch to be applied on
Fedora 17 as well.