]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
viced: avoid aborting on host table exhaustion
authorDerrick Brashear <shadow@dementia.org>
Thu, 11 Aug 2011 15:11:01 +0000 (11:11 -0400)
committerDerrick Brashear <shadow@dementia.org>
Fri, 12 Aug 2011 14:35:42 +0000 (07:35 -0700)
if we exhaust the host table, instead of aborting, return VBUSY at
the client, to defer until hopefully hosts are freed.

Reviewed-on: http://gerrit.openafs.org/5181
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit a3b4cd3c7325c7878ec7b47008f0eec8bfcb1175)

Change-Id: Ic761e487ef0cfe402103bf06bd051958b07641b9
Reviewed-on: http://gerrit.openafs.org/5219
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/viced/afsfileprocs.c
src/viced/host.c
src/viced/host.h

index 9cbbff597f06c4546747f86da4e2a8441fd65b94..a4ab129e0408d9ac0466a9d9aacb0f5b4f0eed4b 100644 (file)
@@ -316,7 +316,7 @@ CallPreamble(struct rx_call *acall, int activecall,
   retry:
     tclient = h_FindClient_r(*tconn);
     if (!tclient) {
-       ViceLog(0, ("CallPreamble: Couldn't get CPS. Too many lockers\n"));
+       ViceLog(0, ("CallPreamble: Couldn't get client.\n"));
        H_UNLOCK;
        return VBUSY;
     }
index bf3259fc9916c92970672cd721814c94f4bc1d16..6897a876869b4f76ba77bcf9dc439286c851a4b3 100644 (file)
@@ -208,7 +208,7 @@ GetHTBlock(void)
 
     if (HTBlocks == h_MAXHOSTTABLES) {
        ViceLog(0, ("h_MAXHOSTTABLES reached\n"));
-       ShutDownAndCore(PANIC);
+       return;
     }
 
     block = (struct HTBlock *)malloc(sizeof(struct HTBlock));
@@ -241,7 +241,8 @@ GetHT(void)
 
     if (HTFree == NULL)
        GetHTBlock();
-    osi_Assert(HTFree != NULL);
+    if (HTFree == NULL)
+       return NULL;
     entry = HTFree;
     HTFree = entry->next;
     HTs++;
@@ -684,7 +685,7 @@ h_flushhostcps(afs_uint32 hostaddr, afs_uint16 hport)
  */
 #define        DEF_ROPCONS 2115
 
-struct host *
+static struct host *
 h_Alloc_r(struct rx_connection *r_con)
 {
     struct servent *serverentry;
@@ -694,6 +695,8 @@ h_Alloc_r(struct rx_connection *r_con)
 #endif /* FS_STATS_DETAILED */
 
     host = GetHT();
+    if (!host)
+       return NULL;
 
     host->host = rxr_HostOf(r_con);
     host->port = rxr_PortOf(r_con);
@@ -1970,6 +1973,8 @@ h_GetHost_r(struct rx_connection *tcon)
        }
     } else {
        host = h_Alloc_r(tcon); /* returned held and locked */
+       if (!host)
+           goto gethost_out;
        h_gethostcps_r(host, FT_ApproxTime());
        if (!(host->Console & 1)) {
            int pident = 0;
@@ -3379,6 +3384,7 @@ h_stateRestoreHost(struct fs_dump_state * state)
        osi_Assert(hcps != NULL);
     }
 
+    /* for restoring state, we better be able to get a host! */
     host = GetHT();
     osi_Assert(host != NULL);
 
index e9353535a05b133fa8634d54f72a23987bf73d04..58b2b9342588ac583c863b03e519ec16e7eaf658 100644 (file)
@@ -215,8 +215,6 @@ extern int PrintCallBackStats(void);
 extern void *ShutDown(void *);
 extern void ShutDownAndCore(int dopanic);
 
-extern struct host *h_Alloc(struct rx_connection *r_con);
-extern struct host *h_Alloc_r(struct rx_connection *r_con);
 extern int h_Lookup_r(afs_uint32 hostaddr, afs_uint16 hport,
                      struct host **hostp);
 extern struct host *h_LookupUuid_r(afsUUID * uuidp);