]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
libafs: ensure one nat ping connection per srvAddr
authorDerrick Brashear <shadow@dementix.org>
Mon, 13 Feb 2012 03:45:59 +0000 (22:45 -0500)
committerDerrick Brashear <shadow@dementix.org>
Thu, 23 Feb 2012 17:58:44 +0000 (09:58 -0800)
track the natping conn with the srvAddr, ensuring exactly one.

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

Change-Id: I5e74ec3f46f9af335653b6910d2c31c788181c5c
Reviewed-on: http://gerrit.openafs.org/6772
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/afs/afs.h
src/afs/afs_conn.c
src/afs/afs_server.c
src/afs/afs_user.c

index cf9345d481bcec50da81fa75104b0593a38579fc..a3c838d9b899feb595a448b77b54e31110d12e6b 100644 (file)
@@ -400,7 +400,8 @@ struct srvAddr {
     struct srvAddr *next_bkt;  /* next item in hash bucket */
     struct srvAddr *next_sa;   /* another interface on same host */
     struct server *server;     /* back to parent */
-    struct afs_conn *conns;            /* All user connections to this server */
+    struct afs_conn *conns;    /* All user connections to this server */
+    struct afs_conn *natping;
     afs_int32 sa_ip;           /* Host addr in network byte order */
     u_short sa_iprank;         /* indiv ip address priority */
     u_short sa_portal;         /* port addr in network byte order */
index 95baf6c4a13f7f9c23e82f1cf2470be12b30cbec..108df40c3188da8af2b4ec77427fbd6fc0f32656 100644 (file)
@@ -310,6 +310,8 @@ afs_ConnBySA(struct srvAddr *sap, unsigned short aport, afs_int32 acell,
            rx_SetConnSecondsUntilNatPing(tc->id, 0);
            rx_DestroyConnection(tc->id);
            AFS_GLOCK();
+           if (sap->natping == tc)
+               sap->natping = NULL;
        }
        /*
         * Stupid hack to determine if using vldb service or file system
@@ -336,16 +338,12 @@ afs_ConnBySA(struct srvAddr *sap, unsigned short aport, afs_int32 acell,
            rx_SetConnIdleDeadTime(tc->id, afs_rx_idledead);
 
        /*
-        * Only do this for the base connection, not per-user.
-        * Will need to be revisited if/when CB gets security.
+        * Only do this for one connection
         */
-       if ((isec == 0) && (service != 52) && !(tu->states & UTokensBad) &&
-           (tu->vid == UNDEFVID) && (isrep == 0)
-#ifndef UKERNEL /* ukernel runs as just one uid anyway */
-           && (tu->uid == 0)
-#endif
-           )
+       if ((service != 52) && (sap->natping == NULL)) {
+           sap->natping = tc;
            rx_SetConnSecondsUntilNatPing(tc->id, 20);
+       }
 
        tc->forceConnectFS = 0; /* apparently we're appropriately connected now */
        if (csec)
index 769f5e17861c1d58e7169a3f5dccb64d076db2f1..0bfdce63140d4eba727019c2cf213c8a6a1f66e5 100644 (file)
@@ -2072,6 +2072,7 @@ afs_RemoveAllConns(void)
                         tc = ntc;
                     }
                     sa->conns = NULL;
+                   sa->natping = NULL;
                 }
             }
         }
index f101ab8bc71b2427b05fb783273edeb44b044b6b..f471216210a7bf116c88f96432e9a90e86cde3de 100644 (file)
@@ -74,8 +74,18 @@ RemoveUserConns(struct unixuser *au)
                    if (tc->user == au && tc->refCount == 0) {
                        *lc = tc->next;
                        AFS_GUNLOCK();
+                       rx_SetConnSecondsUntilNatPing(tc->id, 0);
                        rx_DestroyConnection(tc->id);
                        AFS_GLOCK();
+                       if (tc->srvr->natping == tc) {
+                           struct afs_conn *nc = sa->conns;
+                           if (nc == tc)
+                               nc = *lc;
+                           if (nc && nc->id) {
+                               rx_SetConnSecondsUntilNatPing((nc->id), 20);
+                               tc->srvr->natping = nc;
+                           }
+                       }
                        afs_osi_Free(tc, sizeof(struct afs_conn));
                        break;  /* at most one instance per server */
                    }           /*Found unreferenced connection for user */