DAFS: do not save or restore host state if CPS in progress
[openafs.git] / src / viced / host.c
index e44bdb0..36f9e88 100644 (file)
@@ -53,7 +53,6 @@ extern int CurrentConnections;
 extern int SystemId;
 extern int AnonymousID;
 extern prlist AnonCPS;
-extern int LogLevel;
 extern struct afsconf_dir *confDir;    /* config dir object */
 extern int lwps;               /* the max number of server threads */
 extern afsUUID FS_HostUUID;
@@ -108,6 +107,9 @@ void h_TossStuff_r(struct host *host);
 #define        IN_CLASSB_SUBNET        0xffffff00
 #endif
 
+#define hostBusyFlags(hf) \
+       ((hf) & (HWHO_INPROGRESS | HCPS_INPROGRESS | HCPS_WAITING) \
+       || !((hf) & ALTADDR))
 
 /* get a new block of CEs and chain it on CEFree */
 static void
@@ -412,7 +414,7 @@ hpr_IdToName(idlist *ids, namelist *names)
     if (code)
        return code;
 
-    code = ubik_PR_IDToName(uclient, 0, ids, names);
+    code = string_PR_IDToName(uclient, 0, ids, names);
     return code;
 }
 
@@ -1128,7 +1130,7 @@ h_AddHostToUuidHashTable_r(struct afsUUID *uuid, struct host *host)
 
        if (chain->hostPtr->z.interface &&
            afs_uuid_equal(&chain->hostPtr->z.interface->uuid, uuid)) {
-           if (LogLevel >= 125) {
+           if (GetLogLevel() >= 125) {
                afsUUID_to_string(&chain->hostPtr->z.interface->uuid, uuid1,
                                  127);
                afsUUID_to_string(uuid, uuid2, 127);
@@ -1149,7 +1151,7 @@ h_AddHostToUuidHashTable_r(struct afsUUID *uuid, struct host *host)
     chain->hostPtr = host;
     chain->next = hostUuidHashTable[index];
     hostUuidHashTable[index] = chain;
-         if (LogLevel < 125)
+         if (GetLogLevel() < 125)
               return;
      afsUUID_to_string(uuid, uuid2, 127);
      ViceLog(125,
@@ -1173,7 +1175,7 @@ h_DeleteHostFromUuidHashTable_r(struct host *host)
      /* hash into proper bucket */
      index = h_UuidHashIndex(&host->z.interface->uuid);
 
-     if (LogLevel >= 125)
+     if (GetLogLevel() >= 125)
         afsUUID_to_string(&host->z.interface->uuid, uuid1, 127);
      for (uhp = &hostUuidHashTable[index]; (uth = *uhp); uhp = &uth->next) {
          opr_Assert(uth->hostPtr);
@@ -3175,8 +3177,7 @@ h_isBusy_r(struct host *host)
        return 1;
     }
 
-    if ((host->z.hostFlags & HWHO_INPROGRESS) || !(host->z.hostFlags & ALTADDR)) {
-       /* We shouldn't hit this if the host wasn't locked, but just in case... */
+    if (hostBusyFlags(host->z.hostFlags)) {
        return 1;
     }
 
@@ -3638,7 +3639,7 @@ h_stateRestoreHost(struct fs_dump_state * state)
        opr_Assert(hcps != NULL);
     }
 
-    if ((hdsk.hostFlags & HWHO_INPROGRESS) || !(hdsk.hostFlags & ALTADDR)) {
+    if (hostBusyFlags(hdsk.hostFlags)) {
        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),
@@ -4259,7 +4260,7 @@ initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf)
 
     h_AddHostToUuidHashTable_r(&interface->uuid, host);
 
-    if (LogLevel >= 125) {
+    if (GetLogLevel() >= 125) {
        afsUUID_to_string(&interface->uuid, uuidstr, 127);
 
        ViceLog(125, ("--- uuid %s\n", uuidstr));