linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: "Kwolek, Adam" <adam.kwolek@intel.com>
Cc: "Williams, Dan J" <dan.j.williams@intel.com>,
	"linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org>,
	"Neubauer, Wojciech" <Wojciech.Neubauer@intel.com>,
	"Ciechanowski, Ed" <ed.ciechanowski@intel.com>
Subject: Re: open_dev_excl in reshape_container() fails
Date: Mon, 17 Jan 2011 15:07:34 +1100	[thread overview]
Message-ID: <20110117150734.4473de2f@notabene.brown> (raw)
In-Reply-To: <905EDD02F158D948B186911EB64DB3D176E5A6CF@irsmsx503.ger.corp.intel.com>

On Fri, 14 Jan 2011 10:36:04 +0000 "Kwolek, Adam" <adam.kwolek@intel.com>
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@intel.com>
> Date: Fri, 14 Jan 2011 11:11:19 +0100
> Subject: [PATCH] ADK: open workaround 2
> 
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
> ---
>  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);


      parent reply	other threads:[~2011-01-17  4:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-13 15:40 open_dev_excl in reshape_container() fails Kwolek, Adam
2011-01-13 17:27 ` Dan Williams
2011-01-14  7:31   ` Kwolek, Adam
2011-01-14 10:36     ` Kwolek, Adam
2011-01-14 22:49       ` Dan Williams
2011-01-17  4:07       ` NeilBrown [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110117150734.4473de2f@notabene.brown \
    --to=neilb@suse.de \
    --cc=Wojciech.Neubauer@intel.com \
    --cc=adam.kwolek@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ed.ciechanowski@intel.com \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).