Re: [PATCH 1/1] Grow: close fd earlier to avoid "cannot get excl access" when stopping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pawel Baldysiak <pawel.baldysiak@xxxxxxxxx> 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@xxxxxxxxx>
> ---
>  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


--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux