Re: [PATCH 7/9] FIX: Array cannot be opened for writing on restart

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

 



On Wed, 09 Mar 2011 14:46:26 +0100 Adam Kwolek <adam.kwolek@xxxxxxxxx> wrote:

> When reshape is restarted array (in readonly state) cannot be opened for writing.
> For reshape restart open array for reading only.
> Array is configured already and no writes are required.
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
> ---
> 
>  Grow.c |   12 +++++++++++-
>  1 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/Grow.c b/Grow.c
> index 67bbb26..e392290 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -2240,7 +2240,17 @@ int reshape_container(char *container, char *devname,
>  		if (!content)
>  			break;
>  
> -		fd = open_dev(mdstat->devnum);
> +		if (restart) {
> +			char buf[20];
> +			/* array is in readonly state,
> +			 * so cannot be opened for writting
> +			 */
> +			sprintf(buf, "%d:%d",
> +				dev2major(mdstat->devnum),
> +				dev2minor(mdstat->devnum));
> +			fd = dev_open(buf, O_RDONLY);
> +		} else
> +			fd = open_dev(mdstat->devnum);
>  		if (fd < 0)
>  			break;
>  		adev = map_dev(dev2major(mdstat->devnum),
> 

I changed open_dev to always open O_RDONLY instead.  That
seems to be quite sufficient.

Thanks,
NeilBrown

--
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