summaryrefslogtreecommitdiff
path: root/Assemble.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-11-22 19:35:24 +1100
committerNeilBrown <neilb@suse.de>2010-11-22 19:35:24 +1100
commit1e2b276535cea41c348292a019bdda8a58cb1679 (patch)
tree585ffe39d36a524bb5a7f76e4da16129c35c0455 /Assemble.c
parent4e8d9f0a1650cd187554d7d34fd85c74441cbc7c (diff)
Report error in --update string is not recognised.
If an --update is requested by the relevant metadata doesn't understand it, print a useful message rather than silently ignoring the issue. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Assemble.c')
-rw-r--r--Assemble.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/Assemble.c b/Assemble.c
index e115ecac..a25fdbe1 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -615,6 +615,7 @@ int Assemble(struct supertype *st, char *mddev,
/* prepare useful information in info structures */
struct stat stb2;
struct supertype *tst;
+ int err;
fstat(mdfd, &stb2);
if (strcmp(update, "uuid")==0 &&
@@ -648,22 +649,33 @@ int Assemble(struct supertype *st, char *mddev,
strcpy(content->name, ident->name);
content->array.md_minor = minor(stb2.st_rdev);
- tst->ss->update_super(tst, content, update,
- devname, verbose,
- ident->uuid_set, homehost);
+ if (strcmp(update, "byteorder") == 0)
+ err = 0;
+ else
+ err = tst->ss->update_super(tst, content, update,
+ devname, verbose,
+ ident->uuid_set,
+ homehost);
+ if (err < 0) {
+ fprintf(stderr,
+ Name ": --update=%s not understood"
+ " for %s metadata\n",
+ update, tst->ss->name);
+ tst->ss->free_super(tst);
+ free(tst);
+ close(mdfd);
+ close(dfd);
+ return 1;
+ }
if (strcmp(update, "uuid")==0 &&
!ident->uuid_set) {
ident->uuid_set = 1;
memcpy(ident->uuid, content->uuid, 16);
}
- if (dfd < 0)
- fprintf(stderr, Name ": Cannot open %s for superblock update\n",
- devname);
- else if (tst->ss->store_super(tst, dfd))
+ if (tst->ss->store_super(tst, dfd))
fprintf(stderr, Name ": Could not re-write superblock on %s.\n",
devname);
- if (dfd >= 0)
- close(dfd);
+ close(dfd);
if (strcmp(update, "uuid")==0 &&
ident->bitmap_fd >= 0 && !bitmap_done) {