* [PATCH 1/2] Grow: close file descriptor earlier to avoid "still in use" when stopping
@ 2015-12-23 11:57 Artur Paszkiewicz
2015-12-23 11:57 ` [PATCH 2/2] imsm: abort reshape if sync_action is not "reshape" Artur Paszkiewicz
2015-12-23 23:00 ` [PATCH 1/2] Grow: close file descriptor earlier to avoid "still in use" when stopping NeilBrown
0 siblings, 2 replies; 4+ messages in thread
From: Artur Paszkiewicz @ 2015-12-23 11:57 UTC (permalink / raw)
To: neilb; +Cc: linux-raid, Artur Paszkiewicz, Pawel Baldysiak
Close fd2 as soon as it is no longer needed, before calling
Grow_continue(). Otherwise, we won't be able to stop an array with
external metadata during reshape, because mdadm running in background
will be keeping it open.
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
---
Grow.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Grow.c b/Grow.c
index 80d7b22..f65b36a 100644
--- a/Grow.c
+++ b/Grow.c
@@ -4873,6 +4873,9 @@ int Grow_continue_command(char *devname, int fd,
sysfs_init(content, fd2, mdstat->devnm);
+ close(fd2);
+ fd2 = -1;
+
/* start mdmon in case it is not running
*/
if (!mdmon_running(container))
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] imsm: abort reshape if sync_action is not "reshape"
2015-12-23 11:57 [PATCH 1/2] Grow: close file descriptor earlier to avoid "still in use" when stopping Artur Paszkiewicz
@ 2015-12-23 11:57 ` Artur Paszkiewicz
2015-12-23 23:04 ` NeilBrown
2015-12-23 23:00 ` [PATCH 1/2] Grow: close file descriptor earlier to avoid "still in use" when stopping NeilBrown
1 sibling, 1 reply; 4+ messages in thread
From: Artur Paszkiewicz @ 2015-12-23 11:57 UTC (permalink / raw)
To: neilb; +Cc: linux-raid, Artur Paszkiewicz
When reshape was interrupted, an incorrect checkpoint would be saved in
the migration record. Change wait_for_reshape_imsm() to return -1 when
sync_action is not "reshape" to abort early in imsm_manage_reshape()
without writing the migration record.
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
---
super-intel.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index e609e0c..c7efa98 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -10300,8 +10300,10 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
sysfs_wait(fd, NULL);
if (sysfs_get_str(sra, NULL, "sync_action",
action, 20) > 0 &&
- strncmp(action, "reshape", 7) != 0)
- break;
+ strncmp(action, "reshape", 7) != 0) {
+ close(fd);
+ return -1;
+ }
if (sysfs_fd_get_ll(fd, &completed) < 0) {
dprintf("cannot read reshape_position (in loop)\n");
close(fd);
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] Grow: close file descriptor earlier to avoid "still in use" when stopping
2015-12-23 11:57 [PATCH 1/2] Grow: close file descriptor earlier to avoid "still in use" when stopping Artur Paszkiewicz
2015-12-23 11:57 ` [PATCH 2/2] imsm: abort reshape if sync_action is not "reshape" Artur Paszkiewicz
@ 2015-12-23 23:00 ` NeilBrown
1 sibling, 0 replies; 4+ messages in thread
From: NeilBrown @ 2015-12-23 23:00 UTC (permalink / raw)
Cc: linux-raid, Artur Paszkiewicz, Pawel Baldysiak
[-- Attachment #1: Type: text/plain, Size: 873 bytes --]
On Wed, Dec 23 2015, Artur Paszkiewicz wrote:
> Close fd2 as soon as it is no longer needed, before calling
> Grow_continue(). Otherwise, we won't be able to stop an array with
> external metadata during reshape, because mdadm running in background
> will be keeping it open.
>
> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
> Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
> ---
> Grow.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/Grow.c b/Grow.c
> index 80d7b22..f65b36a 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -4873,6 +4873,9 @@ int Grow_continue_command(char *devname, int fd,
>
> sysfs_init(content, fd2, mdstat->devnm);
>
> + close(fd2);
> + fd2 = -1;
> +
> /* start mdmon in case it is not running
> */
> if (!mdmon_running(container))
applied, thanks.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] imsm: abort reshape if sync_action is not "reshape"
2015-12-23 11:57 ` [PATCH 2/2] imsm: abort reshape if sync_action is not "reshape" Artur Paszkiewicz
@ 2015-12-23 23:04 ` NeilBrown
0 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2015-12-23 23:04 UTC (permalink / raw)
Cc: linux-raid, Artur Paszkiewicz
[-- Attachment #1: Type: text/plain, Size: 1103 bytes --]
On Wed, Dec 23 2015, Artur Paszkiewicz wrote:
> When reshape was interrupted, an incorrect checkpoint would be saved in
> the migration record. Change wait_for_reshape_imsm() to return -1 when
> sync_action is not "reshape" to abort early in imsm_manage_reshape()
> without writing the migration record.
>
> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
> ---
> super-intel.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/super-intel.c b/super-intel.c
> index e609e0c..c7efa98 100644
> --- a/super-intel.c
> +++ b/super-intel.c
> @@ -10300,8 +10300,10 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
> sysfs_wait(fd, NULL);
> if (sysfs_get_str(sra, NULL, "sync_action",
> action, 20) > 0 &&
> - strncmp(action, "reshape", 7) != 0)
> - break;
> + strncmp(action, "reshape", 7) != 0) {
> + close(fd);
> + return -1;
> + }
> if (sysfs_fd_get_ll(fd, &completed) < 0) {
> dprintf("cannot read reshape_position (in loop)\n");
> close(fd);
> --
Applied, thanks.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-12-23 23:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-23 11:57 [PATCH 1/2] Grow: close file descriptor earlier to avoid "still in use" when stopping Artur Paszkiewicz
2015-12-23 11:57 ` [PATCH 2/2] imsm: abort reshape if sync_action is not "reshape" Artur Paszkiewicz
2015-12-23 23:04 ` NeilBrown
2015-12-23 23:00 ` [PATCH 1/2] Grow: close file descriptor earlier to avoid "still in use" when stopping 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).