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 <neilb@suse.de>
This commit is contained in:
parent
e7cb06c845
commit
ecbd9e8160
18
Create.c
18
Create.c
|
@ -332,15 +332,25 @@ int Create(struct supertype *st, char *mddev,
|
|||
char *name = "default";
|
||||
for(i=0; !st && superlist[i]; i++) {
|
||||
st = superlist[i]->match_metadata_desc(name);
|
||||
if (!st)
|
||||
continue;
|
||||
if (do_default_layout)
|
||||
layout = 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 = NULL;
|
||||
chunk = do_default_chunk ? UnSet : chunk;
|
||||
break;
|
||||
case 1: /* All happy */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
6
mdadm.h
6
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,
|
||||
|
|
|
@ -5369,7 +5369,8 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
|
|||
return validate_geometry_imsm_volume(st, level, layout,
|
||||
raiddisks, chunk,
|
||||
size, dev,
|
||||
freesize, verbose);
|
||||
freesize, 1)
|
||||
? 1 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue