summaryrefslogtreecommitdiff
path: root/Grow.c
diff options
context:
space:
mode:
authorAdam Kwolek <adam.kwolek@intel.com>2011-12-15 14:34:36 +1100
committerNeilBrown <neilb@suse.de>2011-12-15 14:34:36 +1100
commit2d04d7e5c38b107905aea37277601d889ecf2302 (patch)
treefad36508ef2df965980bc3628a946dbc72a1e6cb /Grow.c
parenta6482415178f1a834e15d7017a70547d0e965ff0 (diff)
FIX: Do not allow for multiple reshape_array() execution during reshape_container() call
It can happen during reshape restart that reshape_array() can exit without error (e.g. Grow.c:1915) and reshape is not moved to next array. reshape_array() is called again for the same device. Do not allow for such execution and check if last reshaped array is not the current one. This patch can be treat not as solution, but it allows for such errors detection. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Grow.c')
-rw-r--r--Grow.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/Grow.c b/Grow.c
index 184a973a..70b27344 100644
--- a/Grow.c
+++ b/Grow.c
@@ -2462,6 +2462,7 @@ int reshape_container(char *container, char *devname,
{
struct mdinfo *cc = NULL;
int rv = restart;
+ int last_devnum = -1;
/* component_size is not meaningful for a container,
* so pass '-1' meaning 'no change'
@@ -2546,6 +2547,24 @@ int reshape_container(char *container, char *devname,
if (!adev)
adev = content->text_version;
+ if (last_devnum == mdstat->devnum) {
+ /* Do not allow for multiple reshape_array() calls for
+ * the same array.
+ * It can happen when reshape_array() returns without
+ * error, when reshape is not finished (wrong reshape
+ * starting/continuation conditions). Mdmon doesn't
+ * switch to next array in container and reentry
+ * conditions for the same array occur.
+ * This is possibly interim until the behaviour of
+ * reshape_array is resolved().
+ */
+ printf(Name ": Multiple reshape execution detected for "
+ "device %s.", adev);
+ close(fd);
+ break;
+ }
+ last_devnum = mdstat->devnum;
+
sysfs_init(content, fd, mdstat->devnum);
rv = reshape_array(container, fd, adev, st,