linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Lukasz Orlowski <lukasz.orlowski@intel.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: [PATCH 2/3] Create: Unnecessary prompt about device being busy
Date: Wed, 21 Sep 2011 13:36:15 +1000	[thread overview]
Message-ID: <20110921133615.05d336ee@notabene.brown> (raw)
In-Reply-To: <20110919165238.9239.1701.stgit@gklab-128-192.igk.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2824 bytes --]

On Mon, 19 Sep 2011 18:52:38 +0200 Lukasz Orlowski
<lukasz.orlowski@intel.com> wrote:

> Should the geometry validation fail, mdadm exits with error code 2 if the
> style of metadata is not explicitly set to imsm. Prior to that however it
> attempts to exclusively open a device block file. If it succeeds it says
> that the device is not suitable for any kind of array, otherwise it just
> says that the device is busy. The file opened is not closed afterwards.
> 
> Signed-off-by: Lukasz Orlowski <lukasz.orlowski@intel.com>

I'm confused.  What exactly is the problem here?

If geometry validation fails, we need to exit because there is nothing useful
we can do.
We simply check if the problem is that the device is already in use, or if it
is an unusable device and report that.  Then exit.
Seeing we are about the exit there is point closing the file.

What is the scenario when you get incorrect behaviour?

NeilBrown


> ---
>  Create.c |   18 +++++++++---------
>  1 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/Create.c b/Create.c
> index 8d88aa1..47e5fc8 100644
> --- a/Create.c
> +++ b/Create.c
> @@ -346,15 +346,15 @@ int Create(struct supertype *st, char *mddev,
>  
>  			if (!st) {
>  				int dfd = open(dname, O_RDONLY|O_EXCL);
> -				if (dfd < 0) {
> -					fprintf(stderr, Name ": cannot open %s: %s\n",
> -						dname, strerror(errno));
> -					exit(2);
> +				if (dfd >= 0) {
> +					fprintf(stderr,
> +						Name ": device %s not suitable"
> +						" for any style of array\n",
> +						dname);
> +					close(dfd);
>  				}
> -				fprintf(stderr, Name ": device %s not suitable "
> -					"for any style of array\n",
> -					dname);
> -				exit(2);
> +				fail = 1;
> +				break;
>  			}
>  			if (st->ss != &super0 ||
>  			    st->minor_version != 90)
> @@ -443,7 +443,7 @@ int Create(struct supertype *st, char *mddev,
>  			close(fd);
>  		}
>  	}
> -	if (raiddisks + sparedisks > st->max_devs) {
> +	if (st && raiddisks + sparedisks > st->max_devs) {
>  		fprintf(stderr, Name ": Too many devices:"
>  			" %s metadata only supports %d\n",
>  			st->ss->name, st->max_devs);
> 
> ---------------------------------------------------------------------
> Intel Technology Poland sp. z o.o.
> z siedziba w Gdansku
> ul. Slowackiego 173
> 80-298 Gdansk
> 
> Sad Rejonowy Gdansk Polnoc w Gdansku, 
> VII Wydzial Gospodarczy Krajowego Rejestru Sadowego, 
> numer KRS 101882
> 
> NIP 957-07-52-316
> Kapital zakladowy 200.000 zl
> 
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

  reply	other threads:[~2011-09-21  3:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-19 16:52 [PATCH 0/3] Series short description Lukasz Orlowski
2011-09-19 16:52 ` [PATCH 1/3] Create: Allow to create two volumes of different sizes within one container Lukasz Orlowski
2011-09-21  3:31   ` NeilBrown
2011-09-21  6:31     ` Dan Williams
2011-09-21  6:55       ` NeilBrown
2011-12-14 18:15         ` Dan Williams
2011-09-19 16:52 ` [PATCH 2/3] Create: Unnecessary prompt about device being busy Lukasz Orlowski
2011-09-21  3:36   ` NeilBrown [this message]
2011-09-19 16:52 ` [PATCH 3/3] Create: Incorrect message when creating a volume with explicit md dev name Lukasz Orlowski
2011-09-21  3:48   ` NeilBrown

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=20110921133615.05d336ee@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=lukasz.orlowski@intel.com \
    /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).