dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/mdadm-3.2.6-Add-updating-component_size-to-manager-thread-of-mdm.patch

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