Linux RAID subsystem development
 help / color / mirror / Atom feed
* [PATCH] FIX: Do not allow for multiple reshape_array() execution during reshape_container() call
@ 2011-12-14  7:35 Adam Kwolek
  2011-12-14  7:35 ` Adam Kwolek
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Kwolek @ 2011-12-14  7:35 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, ed.ciechanowski, marcin.labun, dan.j.williams

I'm resending it again.
I've noticed that I've made mistake in comment so previously one has compilation problem.

Sorry for my mistake.

BR
Adam


---

Adam Kwolek (1):
      FIX: Do not allow for multiple reshape_array() execution during reshape_container() call


 Grow.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

-- 
Signature

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [PATCH] FIX: Do not allow for multiple reshape_array() execution during reshape_container() call
@ 2011-12-14  7:29 Adam Kwolek
  0 siblings, 0 replies; 3+ messages in thread
From: Adam Kwolek @ 2011-12-14  7:29 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, ed.ciechanowski, marcin.labun, dan.j.williams

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>
---

 Grow.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/Grow.c b/Grow.c
index 184a973..a69f7d4 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,22 @@ 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() call for
+			 * the same array.
+			/* It can happen when resahpe_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.
+			 */
+			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,


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-14  7:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-14  7:35 [PATCH] FIX: Do not allow for multiple reshape_array() execution during reshape_container() call Adam Kwolek
2011-12-14  7:35 ` Adam Kwolek
  -- strict thread matches above, loose matches on Subject: below --
2011-12-14  7:29 Adam Kwolek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox