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