diff --git a/src/viced/host.c b/src/viced/host.c index b8c1550c57..cfa7a55947 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -3391,10 +3391,15 @@ h_stateVerifyAddrHash(struct fs_dump_state * state, struct host * h, tmp, (unsigned)htons(port))); ret = 1; goto done; - } else { + } else if (state->mode == FS_STATE_DUMP_MODE) { ViceLog(0, ("h_stateVerifyAddrHash: warning: addr %s:%u not found in hash\n", tmp, (unsigned)htons(port))); state->flags.warnings_generated = 1; + } else { + ViceLog(0, ("h_stateVerifyAddrHash: error: bad state mode %d\n", + state->mode)); + ret = 1; + goto done; } } @@ -3448,10 +3453,15 @@ h_stateVerifyUuidHash(struct fs_dump_state * state, struct host * h) tmp.buffer)); ret = 1; goto done; - } else { + } else if (state->mode == FS_STATE_DUMP_MODE) { ViceLog(0, ("h_stateVerifyUuidHash: warning: uuid %s not found in hash\n", tmp.buffer)); state->flags.warnings_generated = 1; + } else { + ViceLog(0, ("h_stateVerifyUuidHash: bad state mode %d\n", + state->mode)); + ret = 1; + goto done; } done: diff --git a/src/viced/serialize_state.c b/src/viced/serialize_state.c index 05ed4dfe73..22d2a70e7e 100644 --- a/src/viced/serialize_state.c +++ b/src/viced/serialize_state.c @@ -123,6 +123,8 @@ fs_stateSave(void) goto done; } + state.mode = FS_STATE_DUMP_MODE; + /* XXX * on busy servers, these checks will inevitably fail since stuff drops H_LOCK * all over the place (with structs left in inconsistent states) while RPCs to @@ -328,7 +330,6 @@ fs_stateCreateDump(struct fs_dump_state * state) } state->fd = fd; - state->mode = FS_STATE_DUMP_MODE; memset(state->hdr, 0, sizeof(struct fs_state_header)); fs_stateIncEOF(state, sizeof(struct fs_state_header)); @@ -769,7 +770,7 @@ fs_stateMapFile(struct fs_dump_state * state, int preserve_flag ) flags = PROT_WRITE; break; default: - ViceLog(0, ("fs_stateMapFile: invalid dump state mode\n")); + ViceLog(0, ("fs_stateMapFile: invalid dump state mode %d\n", state->mode)); return 1; } diff --git a/src/viced/serialize_state.h b/src/viced/serialize_state.h index c8e021b691..1e906b8cbb 100644 --- a/src/viced/serialize_state.h +++ b/src/viced/serialize_state.h @@ -230,8 +230,8 @@ struct idx_map_entry_t { struct fs_dump_state { enum { - FS_STATE_DUMP_MODE, - FS_STATE_LOAD_MODE + FS_STATE_DUMP_MODE = 0x1, + FS_STATE_LOAD_MODE = 0x2 } mode; struct { byte do_host_restore; /* whether host restore should be done */