* [PATCH 1/1] Grow: close fd earlier to avoid "cannot get excl access" when stopping
@ 2016-03-11 12:49 Pawel Baldysiak
2016-03-11 17:31 ` Jes Sorensen
0 siblings, 1 reply; 2+ messages in thread
From: Pawel Baldysiak @ 2016-03-11 12:49 UTC (permalink / raw)
To: linux-raid; +Cc: jes.sorensen, artur.paszkiewicz, Pawel Baldysiak
If this file descriptor is not closed here, it remains open during
reshape process and stopping process will end up with
"cannot get exclusive access to container".
Once this file descriptor is no longer needed - it can be closed.
Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
---
Grow.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Grow.c b/Grow.c
index cf2750a..d9db00b 100755
--- a/Grow.c
+++ b/Grow.c
@@ -2070,6 +2070,10 @@ size_change_error:
* number of devices (On-Line Capacity Expansion) must be
* performed at the level of the container
*/
+ if (fd > 0) {
+ close(fd);
+ fd = -1;
+ }
rv = reshape_container(container, devname, -1, st, &info,
c->force, c->backup_file, c->verbose, 0, 0, 0);
frozen = 0;
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] Grow: close fd earlier to avoid "cannot get excl access" when stopping
2016-03-11 12:49 [PATCH 1/1] Grow: close fd earlier to avoid "cannot get excl access" when stopping Pawel Baldysiak
@ 2016-03-11 17:31 ` Jes Sorensen
0 siblings, 0 replies; 2+ messages in thread
From: Jes Sorensen @ 2016-03-11 17:31 UTC (permalink / raw)
To: Pawel Baldysiak; +Cc: linux-raid, artur.paszkiewicz
Pawel Baldysiak <pawel.baldysiak@intel.com> writes:
> If this file descriptor is not closed here, it remains open during
> reshape process and stopping process will end up with
> "cannot get exclusive access to container".
> Once this file descriptor is no longer needed - it can be closed.
>
> Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
> ---
> Grow.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/Grow.c b/Grow.c
> index cf2750a..d9db00b 100755
> --- a/Grow.c
> +++ b/Grow.c
> @@ -2070,6 +2070,10 @@ size_change_error:
> * number of devices (On-Line Capacity Expansion) must be
> * performed at the level of the container
> */
> + if (fd > 0) {
> + close(fd);
> + fd = -1;
> + }
> rv = reshape_container(container, devname, -1, st, &info,
> c->force, c->backup_file, c->verbose, 0, 0, 0);
> frozen = 0;
I went in and looked at this one to see how we deal with the open file
descriptior. I was worried something else could try and access or close
it later, but it looks like we just let it dangle and rely on exit()
cleaning up. So I'll apply this one as is and hopefully someone will
feel excited enough about it to clean it up down the line ;)
Cheers,
Jes
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-11 17:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-11 12:49 [PATCH 1/1] Grow: close fd earlier to avoid "cannot get excl access" when stopping Pawel Baldysiak
2016-03-11 17:31 ` Jes Sorensen
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).