[PATCH] Fixed: Part of output missing during RAID creation

[PATCH] Fixed: Part of output missing during RAID creation

am 20.09.2011 17:21:19 von Lukasz Orlowski

ICAgIEZpeGVkOiBQYXJ0IG9mIG91dHB1dCBtaXNzaW5nIGR1cmluZyBSQUlE IGNyZWF0aW9uCiAg
ICAKICAgIEhhdmluZyBhIGNvbnRhaW5lciBjcmVhdGVkIGNvbnNpc3Rpbmcg b2YgMiBkaXNrcywg
d2hlbiBvbmUgdHJpZWQgdG8gY3JlYXRlCiAgICB0d28gdm9sdW1lcyBvZiB0 aGUgc2FtZSBSQUlE
IGxldmVsLCBhZnRlciBhdHRlbXB0IG9mIGNyZWF0aW5nIHRoZSBzZWNvbmQK ICAgIG9uZSwgcGFy
dCBvZiB0aGUgbWVzc2FnZSB3YXMgbWlzc2luZzoKICAgIAogICAgI21kYWRt IC1DIC9kZXYvbWQv
aW1zbTAgLWFtZCAtZSBpbXNtIC1uIDIgL2Rldi9zZGEgL2Rldi9zZGIgLVIK ICAgICNtZGFkbSAt
QyAvZGV2L21kL015Vm9sdW1lMSAtYW1kIC1sMCAtYzEyOCAtbiAyIC9kZXYv c2RhIC9kZXYvc2Ri
IC1SCiAgICAjbWRhZG0gLUMgL2Rldi9tZC9NeVZvbHVtZTIgLWFtZCAtbDAg LWMxMjggLW4gMiAv
ZGV2L3NkYSAvZGV2L3NkYiAtUgogICAgCiAgICBBZnRlciBjYWxsaW5nIHRo ZSBsYXN0IGNvbW1h
bmQsIHRoZSBvdXRwdXQgd2FzOgogICAgbWRhZG06IGNyZWF0ZSBhYm9ydGVk CiAgICAKICAgIE5v
dyBpdCdzOgogICAgbWRhZG06IGRldmljZSAvZGV2L3NkYiBub3Qgc3VpdGFi bGUgZm9yIHRoaXMg
c3R5bGUgb2YgYXJyYXkKICAgIG1kYWRtOiBjcmVhdGUgYWJvcnRlZAogICAg CiAgICBSZW1vdmVk
IGEgcGllY2Ugb2YgY29kZSBhdHRlbXB0aW5nIHRvIGV4Y2x1c2l2ZWx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93eSAyMDAuMDAwIHpsCgpUaGlz IGUtbWFpbCBhbmQg
YW55IGF0dGFjaG1lbnRzIG1heSBjb250YWluIGNvbmZpZGVudGlhbCBtYXRl cmlhbCBmb3IKdGhl
IHNvbGUgdXNlIG9mIHRoZSBpbnRlbmRlZCByZWNpcGllbnQocykuIEFueSBy ZXZpZXcgb3IgZGlz
dHJpYnV0aW9uCmJ5IG90aGVycyBpcyBzdHJpY3RseSBwcm9oaWJpdGVkLiBJ ZiB5b3UgYXJlIG5v
dCB0aGUgaW50ZW5kZWQKcmVjaXBpZW50LCBwbGVhc2UgY29udGFjdCB0aGUg c2VuZGVyIGFuZCBk
ZWxldGUgYWxsIGNvcGllcy4K

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

[PATCH] Fixed: Part of output missing during RAID creation

am 20.09.2011 17:21:27 von Lukasz Orlowski

SGF2aW5nIGEgY29udGFpbmVyIGNyZWF0ZWQgY29uc2lzdGluZyBvZiAyIGRp c2tzLCB3aGVuIG9u
ZSB0cmllZCB0byBjcmVhdGUKdHdvIHZvbHVtZXMgb2YgdGhlIHNhbWUgUkFJ RCBsZXZlbCwgYWZ0
ZXIgYXR0ZW1wdCBvZiBjcmVhdGluZyB0aGUgc2Vjb25kCm9uZSwgcGFydCBv ZiB0aGUgbWVzc2Fn
ZSB3YXMgbWlzc2luZzoKCiNtZGFkbSAtQyAvZGV2L21kL2ltc20wIC1hbWQg LWUgaW1zbSAtbiAy
IC9kZXYvc2RhIC9kZXYvc2RiIC1SCiNtZGFkbSAtQyAvZGV2L21kL015Vm9s dW1lMSAtYW1kIC1s
MCAtYzEyOCAtbiAyIC9kZXYvc2RhIC9kZXYvc2RiIC1SCiNtZGFkbSAtQyAv ZGV2L21kL015Vm9s
dW1lMiAtYW1kIC1sMCAtYzEyOCAtbiAyIC9kZXYvc2RhIC9kZXYvc2RiIC1S CgpBZnRlciBjYWxs
a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oZXJzIGlzIHN0cmljdGx5IHByb2hpYml0 ZWQuIElmIHlvdSBh
cmUgbm90IHRoZSBpbnRlbmRlZApyZWNpcGllbnQsIHBsZWFzZSBjb250YWN0 IHRoZSBzZW5kZXIg
YW5kIGRlbGV0ZSBhbGwgY29waWVzLgo=

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

Re: [PATCH] Fixed: Part of output missing during RAID creation

am 21.09.2011 06:40:14 von NeilBrown

--Sig_/SrM+du3TX3Za_L5dNiGJN3K
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Tue, 20 Sep 2011 17:21:27 +0200 Lukasz Orlowski
wrote:

> Having a container created consisting of 2 disks, when one tried to create
> two volumes of the same RAID level, after attempt of creating the second
> one, part of the message was missing:
>=20
> #mdadm -C /dev/md/imsm0 -amd -e imsm -n 2 /dev/sda /dev/sdb -R
> #mdadm -C /dev/md/MyVolume1 -amd -l0 -c128 -n 2 /dev/sda /dev/sdb -R
> #mdadm -C /dev/md/MyVolume2 -amd -l0 -c128 -n 2 /dev/sda /dev/sdb -R
>=20
> After calling the last command, the output was:
> mdadm: create aborted
>=20
> Now it's:
> mdadm: device /dev/sdb not suitable for this style of array
> mdadm: create aborted
>=20
> Removed a piece of code attempting to exclusively open a file just to
> check whether it's possible. The reason is that that check was performed
> when it was already determined that a volume cannot be created. Put
> a prompt about the device not being suitable instead.
>=20
> Signed-off-by: Lukasz Orlowski
> ---
> Create.c | 12 ++++--------
> 1 files changed, 4 insertions(+), 8 deletions(-)
>=20
> diff --git a/Create.c b/Create.c
> index baadd9f..b5d35e8 100644
> --- a/Create.c
> +++ b/Create.c
> @@ -349,14 +349,10 @@ int Create(struct supertype *st, char *mddev,
> }
> =20
> if (!st) {
> - int dfd =3D open(dname, O_RDONLY|O_EXCL);
> - if (dfd >=3D 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 this style of array\n",
> + dname);
> fail =3D 1;
> break;
> }
>=20

I think I get what you are trying to do here, but I don't like the approach.
The problem is that validate_geometry should be reporting errors but it is
told not to.

I have just committed the following patch. See if it helps.

NeilBrown


=46rom ecbd9e8160e9de9cc28ad869d303506b1dc69715 Mon Sep 17 00:00:00 2001
From: NeilBrown
Date: Wed, 21 Sep 2011 14:39:01 +1000
Subject: [PATCH] Create: improve messages from validate_geometry.

When validate_geometry finds that we haven't committed to
a metadata yet and that the subdev is a member of 'our'
container, it needs to report any errors it finds as Create()
cannot report them effectively.

So make a slight change to the semantics of the 'verbose' flag
and allow validate_geometry to report if it printed any error
messages.

Signed-off-by: NeilBrown

diff --git a/Create.c b/Create.c
index 8d88aa1..79564c5 100644
--- a/Create.c
+++ b/Create.c
@@ -332,15 +332,25 @@ int Create(struct supertype *st, char *mddev,
char *name =3D "default";
for(i=3D0; !st && superlist[i]; i++) {
st =3D superlist[i]->match_metadata_desc(name);
+ if (!st)
+ continue;
if (do_default_layout)
layout =3D default_layout(st, level, verbose);
- if (st && !st->ss->validate_geometry
- (st, level, layout, raiddisks,
- &chunk, size*2, dname, &freesize,
- verbose > 0)) {
+ switch (st->ss->validate_geometry(
+ st, level, layout, raiddisks,
+ &chunk, size*2, dname, &freesize,
+ verbose > 0)) {
+ case -1: /* Not valid, message printed, and not
+ * worth checking any further */
+ exit(2);
+ break;
+ case 0: /* Geometry not valid */
free(st);
st =3D NULL;
chunk =3D do_default_chunk ? UnSet : chunk;
+ break;
+ case 1: /* All happy */
+ break;
}
}
=20
diff --git a/mdadm.h b/mdadm.h
index bd3063b..8dd37d9 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -702,6 +702,12 @@ extern struct superswitch {
* inter-device dependencies, it should record sufficient details
* so these can be validated.
* Both 'size' and '*freesize' are in sectors. chunk is KiB.
+ * Return value is:
+ * 1: everything is OK
+ * 0: not OK for some reason - if 'verbose', then error was reported.
+ * -1: st->sb was NULL, 'subdev' is a member of a container of this
+ * types, but array is not acceptable for some reason
+ * message was reported even if verbose is 0.
*/
int (*validate_geometry)(struct supertype *st, int level, int layout,
int raiddisks,
diff --git a/super-intel.c b/super-intel.c
index e57d18f..e9d9af8 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -5369,7 +5369,8 @@ static int validate_geometry_imsm(struct supertype *s=
t, int level, int layout,
return validate_geometry_imsm_volume(st, level, layout,
raiddisks, chunk,
size, dev,
- freesize, verbose);
+ freesize, 1)
+ ? 1 : -1;
}
}
=20


--Sig_/SrM+du3TX3Za_L5dNiGJN3K
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)

iD8DBQFOeWquG5fc6gV+Wb0RAjTKAKDKMf88Pcp1GZzzJez2gT4nsNsAiwCg wPig
SE7FL/AJ2oerj3tho7hGyJo=
=I+gj
-----END PGP SIGNATURE-----

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