viced: Log more state restore errors

Some code paths in our state-restoring logic don't log the specific
reason why restoring state failed. These cases shouldn't happen often,
but try to at least log something for them, to try to make sure we
always give a reason.

[adeason@sinenomine.net: Added more messages.]

Change-Id: Ib7c082c4ec221460f7c07be577e78c700f8850a5
Reviewed-on: https://gerrit.openafs.org/14728
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
This commit is contained in:
Mark Vitale 2020-07-17 23:41:14 -04:00 committed by Andrew Deason
parent c5e3b430d8
commit 28bc6daa26
2 changed files with 38 additions and 1 deletions

View File

@ -1791,32 +1791,38 @@ cb_stateRestore(struct fs_dump_state * state)
if (fs_stateReadHeader(state, &state->hdr->cb_offset, state->cb_hdr,
sizeof(struct callback_state_header))) {
ViceLog(0, ("cb_stateRestore: failed to read cb_hdr\n"));
ret = 1;
goto done;
}
if (cb_stateCheckHeader(state->cb_hdr)) {
ViceLog(0, ("cb_stateRestore: failed check of cb_hdr\n"));
ret = 1;
goto done;
}
if (cb_stateAllocMap(state)) {
ViceLog(0, ("cb_stateRestore: failed to allocate map\n"));
ret = 1;
goto done;
}
if (cb_stateRestoreTimeouts(state)) {
ViceLog(0, ("cb_stateRestore: failed to restore timeouts\n"));
ret = 1;
goto done;
}
if (cb_stateRestoreFEHash(state)) {
ViceLog(0, ("cb_stateRestore: failed to restore FE HashTable slab\n"));
ret = 1;
goto done;
}
/* restore FEs and CBs from disk */
if (cb_stateRestoreFEs(state)) {
ViceLog(0, ("cb_stateRestore: failed to restore FEs and CBs\n"));
ret = 1;
goto done;
}
@ -2201,15 +2207,20 @@ cb_stateRestoreTimeouts(struct fs_dump_state * state)
if (fs_stateReadHeader(state, &state->cb_hdr->timeout_offset,
state->cb_timeout_hdr,
sizeof(struct callback_state_timeout_header))) {
ViceLog(0, ("cb_stateRestoreTimeouts: failed to read cb_timeout_hdr\n"));
ret = 1;
goto done;
}
if (state->cb_timeout_hdr->magic != CALLBACK_STATE_TIMEOUT_MAGIC) {
ViceLog(0, ("cb_stateRestoreTimeouts: bad header magic 0x%x != 0x%x\n",
state->cb_timeout_hdr->magic, CALLBACK_STATE_TIMEOUT_MAGIC));
ret = 1;
goto done;
}
if (state->cb_timeout_hdr->records != CB_NUM_TIMEOUT_QUEUES) {
ViceLog(0, ("cb_stateRestoreTimeouts: records %d != %d\n",
state->cb_timeout_hdr->records, CB_NUM_TIMEOUT_QUEUES));
ret = 1;
goto done;
}
@ -2218,11 +2229,16 @@ cb_stateRestoreTimeouts(struct fs_dump_state * state)
if (state->cb_timeout_hdr->len !=
(sizeof(struct callback_state_timeout_header) + len)) {
ViceLog(0, ("cb_stateRestoreTimeouts: header len %d != %d + %d\n",
state->cb_timeout_hdr->len,
(int)sizeof(struct callback_state_timeout_header),
len));
ret = 1;
goto done;
}
if (fs_stateRead(state, timeout, len)) {
ViceLog(0, ("cb_stateRestoreTimeouts: failed read of timeout table\n"));
ret = 1;
goto done;
}
@ -2273,15 +2289,20 @@ cb_stateRestoreFEHash(struct fs_dump_state * state)
if (fs_stateReadHeader(state, &state->cb_hdr->fehash_offset,
state->cb_fehash_hdr,
sizeof(struct callback_state_fehash_header))) {
ViceLog(0, ("cb_stateRestoreFEHash: failed to restore cb_fehash_hdr\n"));
ret = 1;
goto done;
}
if (state->cb_fehash_hdr->magic != CALLBACK_STATE_FEHASH_MAGIC) {
ViceLog(0, ("cb_stateRestoreFEHash: invalid cb_fehash_hdr magic 0x%x != 0x%x\n",
state->cb_fehash_hdr->magic, CALLBACK_STATE_FEHASH_MAGIC));
ret = 1;
goto done;
}
if (state->cb_fehash_hdr->records != FEHASH_SIZE) {
ViceLog(0, ("cb_stateRestoreFEHash: records %d != %d\n",
state->cb_fehash_hdr->records, FEHASH_SIZE));
ret = 1;
goto done;
}
@ -2290,11 +2311,16 @@ cb_stateRestoreFEHash(struct fs_dump_state * state)
if (state->cb_fehash_hdr->len !=
(sizeof(struct callback_state_fehash_header) + len)) {
ViceLog(0, ("cb_stateRestoreFEHash: header len %d != %d + %d\n",
state->cb_fehash_hdr->len,
(int)sizeof(struct callback_state_fehash_header),
len));
ret = 1;
goto done;
}
if (fs_stateRead(state, HashTable, len)) {
ViceLog(0, ("cb_stateRestoreFEHash: failed read of HashTable\n"));
ret = 1;
goto done;
}
@ -2451,6 +2477,8 @@ cb_stateRestoreFE(struct fs_dump_state * state)
}
if (hdr.magic != CALLBACK_STATE_ENTRY_MAGIC) {
ViceLog(0, ("cb_stateRestoreFE: magic 0x%x != 0x%x\n",
hdr.magic, CALLBACK_STATE_ENTRY_MAGIC));
ret = 1;
goto done;
}
@ -2540,11 +2568,17 @@ cb_stateCheckHeader(struct callback_state_header * hdr)
int ret = 0;
if (hdr->stamp.magic != CALLBACK_STATE_MAGIC) {
ViceLog(0, ("cb_stateCheckHeader: magic 0x%x != 0x%x\n",
hdr->stamp.magic, CALLBACK_STATE_MAGIC));
ret = 1;
} else if (hdr->stamp.version != CALLBACK_STATE_VERSION) {
ViceLog(0, ("cb_stateCheckHeader: version %d != %d\n",
hdr->stamp.version, CALLBACK_STATE_VERSION));
ret = 1;
} else if ((hdr->nFEs > cbstuff.nblks) || (hdr->nCBs > cbstuff.nblks)) {
ViceLog(0, ("cb_stateCheckHeader: saved callback state larger than callback memory allocation\n"));
ViceLog(0, ("cb_stateCheckHeader: saved callback state larger than "
"callback memory allocation (%d FEs, %d CBs > %d)\n",
hdr->nFEs, hdr->nCBs, cbstuff.nblks));
ret = 1;
}
return ret;

View File

@ -3231,12 +3231,14 @@ h_stateRestore(struct fs_dump_state * state)
/* seek to the right position and read in the host state header */
if (fs_stateReadHeader(state, &state->hdr->h_offset, state->h_hdr,
sizeof(struct host_state_header))) {
ViceLog(0, ("h_stateRestore: failed to read h_hdr\n"));
state->bail = 1;
goto done;
}
/* check the validity of the header */
if (h_stateCheckHeader(state->h_hdr)) {
ViceLog(0, ("h_stateRestore: failed check of h_hdr\n"));
state->bail = 1;
goto done;
}
@ -3244,6 +3246,7 @@ h_stateRestore(struct fs_dump_state * state)
records = state->h_hdr->records;
if (h_stateAllocMap(state)) {
ViceLog(0, ("h_stateRestore: failed to allocate map\n"));
state->bail = 1;
goto done;
}