]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
windows-afsd-nat-handling-20070310
authorJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 10 Mar 2007 15:48:01 +0000 (15:48 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 10 Mar 2007 15:48:01 +0000 (15:48 +0000)
Improve cache manager performance behind NATs:

 * drop cm_daemonCheckUpInterval from 10 minutes to 4 minutes to bring
   it under the minimum recommended default port mapping idle timeout
   value for NATs

 * when a timeout on an rx connection occurs, retry the request once
   after forcing a new rx connection.  If there was a NAT and the port
   mapping changed, the server would respond to the original addr:port
   associated with the rx connection.  Forcing a new connection will
   allow the request to be responded to if the server is accessible.

   This should eliminate the UP-DOWN-UP-DOWN bouncing that user's have
   seen when working from behind a NAT.

src/WINNT/afsd/cm_conn.c
src/WINNT/afsd/cm_conn.h
src/WINNT/afsd/cm_daemon.c

index d6fb7c341ef1f3d2c0b1bbdd99dea2bd2a900ffe..d86862f795b08db8a5c45f312e66ab58195ef1e1 100644 (file)
@@ -162,6 +162,7 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp,
     long timeUsed, timeLeft;
     long code;
     char addr[16];
+    int forcing_new = 0;
 
     osi_Log2(afsd_logp, "cm_Analyze connp 0x%p, code 0x%x",
              connp, errorCode);
@@ -189,10 +190,6 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp,
         lock_ReleaseWrite(&cm_callbackLock);
     }
 
-    /* If not allowed to retry, don't */
-    if (reqp->flags & CM_REQ_NORETRY)
-        goto out;
-
     /* if timeout - check that it did not exceed the HardDead timeout
      * and retry */
     
@@ -458,7 +455,12 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp,
     else if (errorCode >= -64 && errorCode < 0) {
         /* mark server as down */
         lock_ObtainMutex(&serverp->mx);
-        serverp->flags |= CM_SERVERFLAG_DOWN;
+       if (reqp->flags & CM_REQ_NEW_CONN_FORCED)
+           serverp->flags |= CM_SERVERFLAG_DOWN;
+       else {
+           reqp->flags |= CM_REQ_NEW_CONN_FORCED;
+           forcing_new = 1;
+       }
         lock_ReleaseMutex(&serverp->mx);
        cm_ForceNewConnections(serverp);
         if ( timeLeft > 2 )
@@ -582,7 +584,10 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp,
         }
     }
 
-    if (retry && dead_session)
+    /* If not allowed to retry, don't */
+    if (!forcing_new && (reqp->flags & CM_REQ_NORETRY))
+       retry = 0;
+    else if (retry && dead_session)
         retry = 0;
 
   out:
index 79a9da108564c2c4e3db2e66d741927c662365c3..5f27504a4974d44b1c848307c18a300a705b5fce 100644 (file)
@@ -43,6 +43,7 @@ typedef struct cm_req {
 
 /* flags in cm_req structure */
 #define        CM_REQ_NORETRY          0x1
+#define CM_REQ_NEW_CONN_FORCED  0x2
 
 /*
  * Vice2 error codes
index 0ab8bd565422e5fa179001ac8b9954e246a949fd..d95f13888b1f14144e5f5deb33d0b89f9308066c 100644 (file)
@@ -27,7 +27,7 @@
 
 /* in seconds */
 long cm_daemonCheckDownInterval  = 180;
-long cm_daemonCheckUpInterval    = 600;
+long cm_daemonCheckUpInterval    = 240;
 long cm_daemonCheckVolInterval   = 3600;
 long cm_daemonCheckCBInterval    = 60;
 long cm_daemonCheckLockInterval  = 60;