]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DEVEL15-windows-afsd-nat-handling-20070310
authorJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 10 Mar 2007 15:50:07 +0000 (15:50 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 10 Mar 2007 15:50:07 +0000 (15:50 +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.

(cherry picked from commit f1862d783a610d85a258aaee1d00aff26f348223)

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

index 28ff219b26875f61d52b076ec21342d06cbba30a..23d617a787155718b46f130056cddd7f6a5c09dc 100644 (file)
@@ -168,6 +168,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);
@@ -195,10 +196,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 */
     
@@ -487,7 +484,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 )
@@ -611,7 +613,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 c6c351e11602f79e4139322c6d8cf8fc95565ec5..892a6556016ab03b21e1f12d9808aaed44780415 100644 (file)
@@ -31,7 +31,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;