* [PATCH 1/2] imsm: use timeout when waiting for reshape progress
@ 2016-01-05 16:16 Artur Paszkiewicz
2016-01-05 16:16 ` [PATCH 2/2] imsm: don't update migration record when reshape is interrupted Artur Paszkiewicz
2016-01-07 0:11 ` [PATCH 1/2] imsm: use timeout when waiting for reshape progress NeilBrown
0 siblings, 2 replies; 3+ messages in thread
From: Artur Paszkiewicz @ 2016-01-05 16:16 UTC (permalink / raw)
To: linux-raid; +Cc: Artur Paszkiewicz
Waiting for reshape progress is done by using select() on sync_completed
to block until an exception condition is signalled on the
filedescriptor. This happens when the attribute's value is updated by
the kernel, but if the array is stopped when mdadm is blocked on
select() this will never happen, because this attribute is then removed
and apparently the kernel doesn't do sysfs_notify() when removing a
sysfs attribute. So set a 3 second timeout for the sysfs_wait() call.
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
---
super-intel.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/super-intel.c b/super-intel.c
index 98fe835..68cc8d6 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -10297,7 +10297,8 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
do {
char action[20];
- sysfs_wait(fd, NULL);
+ int timeout = 3000;
+ sysfs_wait(fd, &timeout);
if (sysfs_get_str(sra, NULL, "sync_action",
action, 20) > 0 &&
strncmp(action, "reshape", 7) != 0) {
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] imsm: don't update migration record when reshape is interrupted
2016-01-05 16:16 [PATCH 1/2] imsm: use timeout when waiting for reshape progress Artur Paszkiewicz
@ 2016-01-05 16:16 ` Artur Paszkiewicz
2016-01-07 0:11 ` [PATCH 1/2] imsm: use timeout when waiting for reshape progress NeilBrown
1 sibling, 0 replies; 3+ messages in thread
From: Artur Paszkiewicz @ 2016-01-05 16:16 UTC (permalink / raw)
To: linux-raid; +Cc: Artur Paszkiewicz
Abort imsm_manage_reshape() without updating the migration record if any
error occurs when checking progress. If reshape is interrupted and the
migration record is then updated, the checkpoint will be wrong and will
cause reshape to fail when the array is restarted.
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
---
super-intel.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index 68cc8d6..abf48c0 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -10277,7 +10277,7 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
if (sysfs_fd_get_ll(fd, &completed) < 0) {
dprintf("cannot read reshape_position (no reshape in progres)\n");
close(fd);
- return 0;
+ return 1;
}
if (completed > position_to_set) {
@@ -10566,7 +10566,7 @@ static int imsm_manage_reshape(
sra->reshape_progress = next_step;
/* wait until reshape finish */
- if (wait_for_reshape_imsm(sra, ndata) < 0) {
+ if (wait_for_reshape_imsm(sra, ndata)) {
dprintf("wait_for_reshape_imsm returned error!\n");
goto abort;
}
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] imsm: use timeout when waiting for reshape progress
2016-01-05 16:16 [PATCH 1/2] imsm: use timeout when waiting for reshape progress Artur Paszkiewicz
2016-01-05 16:16 ` [PATCH 2/2] imsm: don't update migration record when reshape is interrupted Artur Paszkiewicz
@ 2016-01-07 0:11 ` NeilBrown
1 sibling, 0 replies; 3+ messages in thread
From: NeilBrown @ 2016-01-07 0:11 UTC (permalink / raw)
To: Artur Paszkiewicz, linux-raid
[-- Attachment #1: Type: text/plain, Size: 1518 bytes --]
On Wed, Jan 06 2016, Artur Paszkiewicz wrote:
> Waiting for reshape progress is done by using select() on sync_completed
> to block until an exception condition is signalled on the
> filedescriptor. This happens when the attribute's value is updated by
> the kernel, but if the array is stopped when mdadm is blocked on
> select() this will never happen, because this attribute is then removed
> and apparently the kernel doesn't do sysfs_notify() when removing a
> sysfs attribute. So set a 3 second timeout for the sysfs_wait() call.
I wonder if we should fix that in the kernel somehow...
I've applied this patch and the following one - thanks.
NeilBrown
>
> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
> ---
> super-intel.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/super-intel.c b/super-intel.c
> index 98fe835..68cc8d6 100644
> --- a/super-intel.c
> +++ b/super-intel.c
> @@ -10297,7 +10297,8 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
>
> do {
> char action[20];
> - sysfs_wait(fd, NULL);
> + int timeout = 3000;
> + sysfs_wait(fd, &timeout);
> if (sysfs_get_str(sra, NULL, "sync_action",
> action, 20) > 0 &&
> strncmp(action, "reshape", 7) != 0) {
> --
> 2.1.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-07 0:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-05 16:16 [PATCH 1/2] imsm: use timeout when waiting for reshape progress Artur Paszkiewicz
2016-01-05 16:16 ` [PATCH 2/2] imsm: don't update migration record when reshape is interrupted Artur Paszkiewicz
2016-01-07 0:11 ` [PATCH 1/2] imsm: use timeout when waiting for reshape progress NeilBrown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).