ukernel: enable nat ping again
[openafs.git] / src / afs / afs_conn.c
index f63ac63..8d456a4 100644 (file)
@@ -146,8 +146,10 @@ release_conns_user_server(struct unixuser *xu, struct server *xs)
                     AFS_GUNLOCK();
                 for(cix = 0; cix < CVEC_LEN; ++cix) {
                     tc = &(tcv->cvec[cix]);
-                    if (tc->activated)
+                    if (tc->activated) {
+                        rx_SetConnSecondsUntilNatPing(tc->id, 0);
                         rx_DestroyConnection(tc->id);
+                    }
                 }
                 if (glocked)
                     AFS_GLOCK();
@@ -175,8 +177,10 @@ release_conns_vector(struct sa_conn_vector *xcv)
             AFS_GUNLOCK(); \
         for(cix = 0; cix < CVEC_LEN; ++cix) {
             tc = &(tcv->cvec[cix]);
-            if (tc->activated)
-                rx_DestroyConnection( tc->id );
+            if (tc->activated) {
+                rx_SetConnSecondsUntilNatPing(tc->id, 0);
+                rx_DestroyConnection(tc->id);
+            }
         }
         if (glocked)
             AFS_GLOCK();
@@ -431,7 +435,8 @@ afs_ConnBySA(struct srvAddr *sap, unsigned short aport, afs_int32 acell,
        if (tc->id) {
            if (glocked)
                 AFS_GUNLOCK();
-           rx_DestroyConnection(tc->id);
+            rx_SetConnSecondsUntilNatPing(tc->id, 0);
+            rx_DestroyConnection(tc->id);
            if (glocked)
                 AFS_GLOCK();
        }
@@ -458,14 +463,17 @@ afs_ConnBySA(struct srvAddr *sap, unsigned short aport, afs_int32 acell,
        /* set to a RX_CALL_TIMEOUT error to allow MTU retry to trigger */
        rx_SetServerConnIdleDeadErr(tc->id, RX_CALL_DEAD);
        rx_SetConnIdleDeadTime(tc->id, afs_rx_idledead);
-       rx_SetMsgsizeRetryErr(tc->id, RX_MSGSIZE);
 
        /*
         * Only do this for the base connection, not per-user.
         * Will need to be revisited if/when CB gets security.
         */
        if ((isec == 0) && (service != 52) && !(tu->states & UTokensBad) &&
-           (tu->viceId == UNDEFVID))
+           (tu->viceId == UNDEFVID)
+#ifndef UKERNEL /* ukernel runs as just one uid anyway */
+           && (tu->uid == 0)
+#endif
+           )
            rx_SetConnSecondsUntilNatPing(tc->id, 20);
 
        tc->forceConnectFS = 0; /* apparently we're appropriately connected now */
@@ -597,22 +605,8 @@ afs_PutConn(struct afs_conn *ac, struct rx_connection *rxconn,
     AFS_STATCNT(afs_PutConn);
     ac->refCount--;
     if (ac->refCount < 0) {
-       static int warned = 0;
-       /* So, someone is 'put'ing more refs than they got. From now on, we
-        * have no idea if the structure is actually still in use, so just
-        * set the refcount to a really negative number to make it unlikely
-        * that the count will ever reach 0 and the conn gets freed. This
-        * leaks memory, but the alternative is panicing, or risking memory
-        * corruption. */
-       ac->refCount = -10000;
-       if (!warned) {
-           warned = 1;
-           afs_warn("afs_PutConn: negative refCount with 0x%lx; this should "
-                    "not ever happen! Trying to carry on anyway, but please "
-                    "report this issue\n",
-                    (unsigned long)(uintptrsz)ac);
-       }
-       return;
+       osi_Panic("afs_PutConn: refcount imbalance 0x%lx %d",
+                 (unsigned long)(uintptrsz)ac, (int)ac->refCount);
     }
     ac->parent->refCount--;
     rx_PutConnection(rxconn);