Re: open_dev_excl in reshape_container() fails

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

 



On Fri, 14 Jan 2011 10:36:04 +0000 "Kwolek, Adam" <adam.kwolek@xxxxxxxxx>
wrote:

> Hi, 
> 
> I think I've found problem root cause.
> As I'm working on "Online Capacity Expansion", my tests uses mounted arrays - this is in conflict with open_dev_ext()
> and fails this function. Evrything is ok  This means that reshape operation cannot be performed online (or this is valid on my system only?).
> 
> I do not know why on begin (in main() of mdadm.c) this function can succeed and later not (later system blocks array ?).
> More, when I've made some open_dev_exe()+close() earlier, it works later also (please look used code below/treat patch as demo/).
> 
> Summarizing problem is related to mounted arrays only.

Thanks.  I see what is wrong - it is OK to open containers exclusively, but
not arrays  - as you say, that could be mounted.

I have applied your original patch to change open_dev_excl to open_dev now
that I understand what the issue is..

Thanks,

NeilBrown


> 
> BR
> Adam
> 
> 
> >From cf545d2ffb906096da89aff7b1a5c5830221cc4a Mon Sep 17 00:00:00 2001
> From: Adam Kwolek <adam.kwolek@xxxxxxxxx>
> Date: Fri, 14 Jan 2011 11:11:19 +0100
> Subject: [PATCH] ADK: open workaround 2
> 
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
> ---
>  Grow.c  |   17 +++++++++++++++++
>  mdadm.c |   11 +++++++++++
>  2 files changed, 28 insertions(+), 0 deletions(-)
> 
> diff --git a/Grow.c b/Grow.c
> index 763287b..3b37f97 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -1285,6 +1285,10 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
>  
>  	struct mdinfo info;
>  	struct mdinfo *sra;
> +//adk
> +	int fd_test = open_dev_excl(126);
> +	if (fd_test >= 0)
> +		close(fd_test);
>  
>  	if (ioctl(fd, GET_ARRAY_INFO, &array) < 0) {
>  		fprintf(stderr, Name ": %s is not an active md array - aborting\n",
> @@ -1319,6 +1323,10 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
>  			" beyond %d\n", st->max_devs);
>  		return 1;
>  	}
> +//adk
> +	fd_test = open_dev_excl(126);
> +	if (fd_test >= 0)
> +		close(fd_test);
>  
>  	/* in the external case we need to check that the requested reshape is
>  	 * supported, and perform an initial check that the container holds the
> @@ -1394,6 +1402,10 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
>  			" be reshaped\n", devname);
>  		return 1;
>  	}
> +//adk
> +	fd_test = open_dev_excl(126);
> +	if (fd_test >= 0)
> +		close(fd_test);
>  
>  	/* ========= set size =============== */
>  	if (size >= 0 && (size == 0 || size != array.size)) {
> @@ -1462,6 +1474,10 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
>  			goto release;
>  		}
>  	}
> +//adk
> +	fd_test = open_dev_excl(126);
> +	if (fd_test >= 0)
> +		close(fd_test);
>  
>  	info.array = array;
>  	sysfs_init(&info, fd, NoMdDev);
> @@ -1545,6 +1561,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
>  		 * number of devices (On-Line Capacity Expansion) must be
>  		 * performed at the level of the container
>  		 */
> +
>  		rv = reshape_container(container, fd, devname, st, &info,
>  				       force, backup_file, quiet);
>  		frozen = 0;
> diff --git a/mdadm.c b/mdadm.c
> index 2ffe94f..bc9d34e 100644
> --- a/mdadm.c
> +++ b/mdadm.c
> @@ -127,6 +127,7 @@ int main(int argc, char *argv[])
>  	ident.name[0] = 0;
>  	ident.container = NULL;
>  	ident.member = NULL;
> +//adk - can open
>  
>  	while ((option_index = -1) ,
>  	       (opt=getopt_long(argc, argv,
> @@ -134,6 +135,11 @@ int main(int argc, char *argv[])
>  				&option_index)) != -1) {
>  		int newmode = mode;
>  		/* firstly, some mode-independent options */
> +//adk
> +		int fd_test = open_dev_excl(126);
> +		if (fd_test >= 0)
> +			close(fd_test);
> +
>  		switch(opt) {
>  		case HelpOptions:
>  			print_help = 2;
> @@ -1115,6 +1121,11 @@ int main(int argc, char *argv[])
>  			exit(2);
>  		}
>  		if (mode == MANAGE || mode == GROW) {
> +//adk
> +			int fd_test = open_dev_excl(126);
> +			if (fd_test >= 0)
> +				close(fd_test);
> +
>  			mdfd = open_mddev(devlist->devname, 1);
>  			if (mdfd < 0)
>  				exit(1);

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