]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DAFS: Skip hosts with invalid flags on restore
authorAndrew Deason <adeason@sinenomine.net>
Thu, 29 Sep 2011 21:04:54 +0000 (16:04 -0500)
committerDerrick Brashear <shadow@dementix.org>
Sun, 9 Oct 2011 17:21:28 +0000 (10:21 -0700)
Host entries with HWHO_INPROGRESS set or ALTADDR unset do not have
valid state, since those flags indicate that the fileserver was in the
middle of identifying the host when the host struct was serialized.
Skip entries from the on-disk host data that have such invalid flags
set when restoring state, so we do not load invalid data.

Reviewed-on: http://gerrit.openafs.org/5527
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 6e7b31ef0a69b8ea39e8acc474a7aab48f828d3d)

Change-Id: Ifa69ec30bda8f9ba162954d39f9b60d9fc630289
Reviewed-on: http://gerrit.openafs.org/5545
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/tviced/serialize_state.h
src/viced/callback.c
src/viced/host.c

index 6478e714ea39f55f1640319aacbc227e810db038..2a34723d4a1a651763035a6b4ec8550fd3ca9c80 100644 (file)
@@ -41,6 +41,7 @@
 
 /* values for the 'valid' field in idx_map_entry_t */
 #define FS_STATE_IDX_VALID 1
+#define FS_STATE_IDX_SKIPPED 2
 
 /*
  * on-disk structures
index 8e2d2ad753fe907bf75f8db590638d467bb54cfc..40bebec69d54a536ec265c4469a79bb8c6c7bfc4 100644 (file)
@@ -2460,6 +2460,12 @@ cb_stateRestoreCBs(struct fs_dump_state * state, struct FileEntry * fe,
 
     for (idx = 0; idx < niovecs; idx++) {
        cbdsk = (struct CBDiskEntry *) iov[idx].iov_base;
+
+       if (cbdsk->cb.hhead < state->h_map.len &&
+           state->h_map.entries[cbdsk->cb.hhead].valid == FS_STATE_IDX_SKIPPED) {
+           continue;
+       }
+
        if ((cb = GetCB()) == NULL) {
            ViceLog(0, ("cb_stateRestoreCBs: ran out of free CallBack structures\n"));
            ret = 1;
index 65e54d321548cb38fa6ac0590655d2a9d6933179..a93b93bd5a2abc1690c587e419434d77d3110f68 100644 (file)
@@ -3384,6 +3384,16 @@ h_stateRestoreHost(struct fs_dump_state * state)
        osi_Assert(hcps != NULL);
     }
 
+    if ((hdsk.hostFlags & HWHO_INPROGRESS) || !(hdsk.hostFlags & ALTADDR)) {
+       char hoststr[16];
+       ViceLog(0, ("h_stateRestoreHost: skipping host %s:%d due to invalid flags 0x%x\n",
+                   afs_inet_ntoa_r(hdsk.host, hoststr), (int)ntohs(hdsk.port),
+                   (unsigned)hdsk.hostFlags));
+       bail = 0;
+       state->h_map.entries[hdsk.index].valid = FS_STATE_IDX_SKIPPED;
+       goto done;
+    }
+
     /* for restoring state, we better be able to get a host! */
     host = GetHT();
     osi_Assert(host != NULL);