afs: Pass rx connection to print_internet_address
authorAndrew Deason <adeason@sinenomine.net>
Tue, 30 Oct 2012 18:30:27 +0000 (13:30 -0500)
committerDerrick Brashear <shadow@your-file-system.com>
Mon, 12 Nov 2012 18:34:00 +0000 (10:34 -0800)
Make print_internet_address take an rx_connection, so it can print out
more information based on rx info. Currently it does not use the
connection; this commit is just for adding the connection to the
interface, and adjusting all of the callers to cope. There should be
no behavior change.

Change-Id: I410ffe43b7b6fc4d5c82666529c9263969820185
Reviewed-on: http://gerrit.openafs.org/8409
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

src/afs/afs_analyze.c
src/afs/afs_prototypes.h
src/afs/afs_server.c
src/afs/afs_util.c

index d413a32..2555560 100644 (file)
@@ -650,7 +650,7 @@ afs_Analyze(struct afs_conn *aconn, struct rx_connection *rxconn,
             */
            goto out;
        }
-       afs_ServerDown(sa, acode);
+       afs_ServerDown(sa, acode, rxconn);
        ForceNewConnections(sa); /* multi homed clients lock:afs_xsrvAddr? */
        if (aerrP)
            (aerrP->err_Server)++;
@@ -770,7 +770,7 @@ afs_Analyze(struct afs_conn *aconn, struct rx_connection *rxconn,
     }
     /* check for ubik errors; treat them like crashed servers */
     else if (acode >= ERROR_TABLE_BASE_U && acode < ERROR_TABLE_BASE_U + 255) {
-       afs_ServerDown(sa, acode);
+       afs_ServerDown(sa, acode, rxconn);
        if (aerrP)
            (aerrP->err_Server)++;
        shouldRetry = 1;        /* retryable (maybe one is working) */
@@ -830,7 +830,7 @@ afs_Analyze(struct afs_conn *aconn, struct rx_connection *rxconn,
         * retry in case there is another server.  However, if we find
         * no connection (aconn == 0) we set the networkError flag.
         */
-       afs_ServerDown(sa, acode);
+       afs_ServerDown(sa, acode, rxconn);
        if (aerrP)
            (aerrP->err_Server)++;
        VSleep(1);              /* Just a hack for desperate times. */
index 5418036..1283d07 100644 (file)
@@ -866,7 +866,8 @@ extern struct server *afs_GetServer(afs_uint32 * aserver, afs_int32 nservers,
 extern void afs_GetCapabilities(struct server *ts);
 extern void ForceAllNewConnections(void);
 extern void afs_MarkServerUpOrDown(struct srvAddr *sa, int a_isDown);
-extern afs_int32 afs_ServerDown(struct srvAddr *sa, int code);
+extern afs_int32 afs_ServerDown(struct srvAddr *sa, int code,
+                                struct rx_connection *rxconn);
 extern void afs_CountServers(void);
 extern void afs_CheckServers(int adown, struct cell *acellp);
 extern void afs_LoopServers(int adown, struct cell *acellp, int vlalso,
@@ -1028,7 +1029,8 @@ extern char *afs_strrchr(char *s, int c);
 #endif
 extern char *afs_strdup(char *s);
 extern void print_internet_address(char *preamble, struct srvAddr *sa,
-                                  char *postamble, int flag, int code);
+                                  char *postamble, int flag, int code,
+                                  struct rx_connection *rxconn);
 extern afs_int32 afs_data_pointer_to_int32(const void *p);
 
 extern void afs_CheckLocks(void);
index c51bf3e..d7e3d46 100644 (file)
@@ -230,7 +230,7 @@ afs_MarkServerUpOrDown(struct srvAddr *sa, int a_isDown)
 
 
 afs_int32
-afs_ServerDown(struct srvAddr *sa, int code)
+afs_ServerDown(struct srvAddr *sa, int code, struct rx_connection *rxconn)
 {
     struct server *aserver = sa->server;
 
@@ -239,11 +239,11 @@ afs_ServerDown(struct srvAddr *sa, int code)
        return 0;
     afs_MarkServerUpOrDown(sa, SRVR_ISDOWN);
     if (sa->sa_portal == aserver->cell->vlport)
-       print_internet_address
-           ("afs: Lost contact with volume location server ", sa, "", 1, code);
+       print_internet_address("afs: Lost contact with volume location server ",
+                             sa, "", 1, code, rxconn);
     else
        print_internet_address("afs: Lost contact with file server ", sa, "",
-                              1, code);
+                              1, code, rxconn);
     return 1;
 }                              /*ServerDown */
 
@@ -301,7 +301,6 @@ CheckVLServer(struct srvAddr *sa, struct vrequest *areq)
     code = VL_ProbeServer(rxconn);
     RX_AFS_GLOCK();
     rx_SetConnDeadTime(rxconn, afs_rx_deadtime);
-    afs_PutConn(tc, rxconn, SHARED_LOCK);
     /*
      * If probe worked, or probe call not yet defined (for compatibility
      * with old vlsevers), then we treat this server as running again
@@ -310,9 +309,10 @@ CheckVLServer(struct srvAddr *sa, struct vrequest *areq)
        if (tc->parent->srvr == sa) {
            afs_MarkServerUpOrDown(sa, 0);
            print_internet_address("afs: volume location server ", sa,
-                                  " is back up", 2, code);
+                                  " is back up", 2, code, rxconn);
        }
     }
+    afs_PutConn(tc, rxconn, SHARED_LOCK);
 
 }                              /*CheckVLServer */
 
@@ -518,7 +518,8 @@ ForceAllNewConnections(void)
 }
 
 static void
-CkSrv_MarkUpDown(struct afs_conn **conns, int nconns, afs_int32 *results)
+CkSrv_MarkUpDown(struct afs_conn **conns, struct rx_connection **rxconns,
+                 int nconns, afs_int32 *results)
 {
     struct srvAddr *sa;
     struct afs_conn *tc;
@@ -532,7 +533,7 @@ CkSrv_MarkUpDown(struct afs_conn **conns, int nconns, afs_int32 *results)
            (tc->parent->srvr == sa)) {
            /* server back up */
            print_internet_address("afs: file server ", sa, " is back up", 2,
-                                  results[i]);
+                                  results[i], rxconns[i]);
 
            ObtainWriteLock(&afs_xserver, 244);
            ObtainWriteLock(&afs_xsrvAddr, 245);
@@ -546,7 +547,7 @@ CkSrv_MarkUpDown(struct afs_conn **conns, int nconns, afs_int32 *results)
        } else {
            if (results[i] < 0) {
                /* server crashed */
-               afs_ServerDown(sa, results[i]);
+               afs_ServerDown(sa, results[i], rxconns[i]);
                ForceNewConnections(sa);  /* multi homed clients */
            }
        }
@@ -597,7 +598,7 @@ CkSrv_GetCaps(int nconns, struct rx_connection **rxconns,
                caps[i].Capabilities_len = 0;
            }
     }
-    CkSrv_MarkUpDown(conns, nconns, results);
+    CkSrv_MarkUpDown(conns, rxconns, nconns, results);
 
     afs_osi_Free(caps, nconns * sizeof(Capabilities));
     afs_osi_Free(results, nconns * sizeof(afs_int32));
@@ -1515,7 +1516,7 @@ afs_GetCapabilities(struct server *ts)
     ObtainWriteLock(&afs_xserver, 723);
     /* we forced a conn above; important we mark it down if needed */
     if ((code < 0) && (code != RXGEN_OPCODE)) {
-       afs_ServerDown(tc->parent->srvr, code);
+       afs_ServerDown(tc->parent->srvr, code, rxconn);
        ForceNewConnections(tc->parent->srvr); /* multi homed clients */
     }
     afs_PutConn(tc, rxconn, SHARED_LOCK);
index c186cf8..9105beb 100644 (file)
@@ -194,7 +194,7 @@ afs_strdup(char *s)
 
 void
 print_internet_address(char *preamble, struct srvAddr *sa, char *postamble,
-                      int flag, int code)
+                      int flag, int code, struct rx_connection *rxconn)
 {
     struct server *aserver = sa->server;
     char *ptr = "\n";