All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IMSM: retry reading sync_completed during reshape
@ 2016-05-17 11:24 Pawel Baldysiak
  2016-05-19 14:45 ` Jes Sorensen
  0 siblings, 1 reply; 2+ messages in thread
From: Pawel Baldysiak @ 2016-05-17 11:24 UTC (permalink / raw)
  To: jes.sorensen
  Cc: linux-raid, artur.paszkiewicz, aleksey.obitotskiy,
	tomasz.majchrzak

The sync_completed after restarting a reshape
(for example - after reboot) is set to "delayed" until
mdmon changes the state. Mdadm does not wait for that change with
old kernels. If this condition occurs - it exits and reshape
is not continuing. This patch adds retry of reading sync_complete
with a delay. It gives time for mdmon to change the "delayed" state.

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
---
 super-intel.c |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index ba3ee48..7e2860c 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -10378,6 +10378,7 @@ exit_imsm_reshape_super:
 int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
 {
 	int fd = sysfs_get_fd(sra, NULL, "sync_completed");
+	int retry = 3;
 	unsigned long long completed;
 	/* to_complete : new sync_max position */
 	unsigned long long to_complete = sra->reshape_progress;
@@ -10388,11 +10389,17 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
 		return 1;
 	}
 
-	if (sysfs_fd_get_ll(fd, &completed) < 0) {
-		dprintf("cannot read reshape_position (no reshape in progres)\n");
-		close(fd);
-		return 1;
-	}
+	do {
+		if (sysfs_fd_get_ll(fd, &completed) < 0) {
+			if (!retry) {
+				dprintf("cannot read reshape_position (no reshape in progres)\n");
+				close(fd);
+				return 1;
+			}
+			usleep(30000);
+		} else
+			break;
+	} while (retry--);
 
 	if (completed > position_to_set) {
 		dprintf("wrong next position to set %llu (%llu)\n",


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

* Re: [PATCH] IMSM: retry reading sync_completed during reshape
  2016-05-17 11:24 [PATCH] IMSM: retry reading sync_completed during reshape Pawel Baldysiak
@ 2016-05-19 14:45 ` Jes Sorensen
  0 siblings, 0 replies; 2+ messages in thread
From: Jes Sorensen @ 2016-05-19 14:45 UTC (permalink / raw)
  To: Pawel Baldysiak
  Cc: linux-raid, artur.paszkiewicz, aleksey.obitotskiy,
	tomasz.majchrzak

Pawel Baldysiak <pawel.baldysiak@intel.com> writes:
> The sync_completed after restarting a reshape
> (for example - after reboot) is set to "delayed" until
> mdmon changes the state. Mdadm does not wait for that change with
> old kernels. If this condition occurs - it exits and reshape
> is not continuing. This patch adds retry of reading sync_complete
> with a delay. It gives time for mdmon to change the "delayed" state.
>
> Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
> ---
>  super-intel.c |   17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)

Hi Pawel,

Applied, thanks!

I have to admit I don't like this kind of fixes very much, delaying and
hoping for something to happen in time, but with the APIs we have it's
probably the best we can do.

Cheers,
Jes

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

end of thread, other threads:[~2016-05-19 14:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-17 11:24 [PATCH] IMSM: retry reading sync_completed during reshape Pawel Baldysiak
2016-05-19 14:45 ` Jes Sorensen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.