summaryrefslogtreecommitdiff
path: root/super0.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-02-07 11:51:21 +1100
committerNeilBrown <neilb@suse.de>2013-02-10 15:40:42 +1100
commitdef1133297d8f619c8fd644d6d8c6633ddcaa929 (patch)
tree5a8375edf867479695e2aeb8d9d170e8d742b175 /super0.c
parent9698df15d9efaa32d30e17ff839315cedf1e7984 (diff)
make --update=homehost work again
Commit 1e2b276535cea41c348292a019bdda8a58cb1679 (Report error in --update string is not recognised) broke homehost updating functionality because it depended on each string comparison being done even after we already found a match. Make it work again by restructuring code. Reported-by: (and original version by) Justin Maggard <jmaggard10@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super0.c')
-rw-r--r--super0.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/super0.c b/super0.c
index d54a5d7f..bc95fb66 100644
--- a/super0.c
+++ b/super0.c
@@ -435,6 +435,18 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
int rv = 0;
int uuid[4];
mdp_super_t *sb = st->sb;
+
+ if (strcmp(update, "homehost") == 0 &&
+ homehost) {
+ /* note that 'homehost' is special as it is really
+ * a "uuid" update.
+ */
+ uuid_set = 0;
+ update = "uuid";
+ info->uuid[0] = sb->set_uuid0;
+ info->uuid[1] = sb->set_uuid1;
+ }
+
if (strcmp(update, "sparc2.2")==0 ) {
/* 2.2 sparc put the events in the wrong place
* So we copy the tail of the superblock
@@ -551,12 +563,6 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
/* make sure resync happens */
sb->state &= ~(1<<MD_SB_CLEAN);
sb->recovery_cp = 0;
- } else if (strcmp(update, "homehost") == 0 &&
- homehost) {
- uuid_set = 0;
- update = "uuid";
- info->uuid[0] = sb->set_uuid0;
- info->uuid[1] = sb->set_uuid1;
} else if (strcmp(update, "uuid") == 0) {
if (!uuid_set && homehost) {
char buf[20];