From a2cc53224cc0ee39324c8124ca8cd5e24bf10b67 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 19 Jun 2009 04:14:39 +0000 Subject: [PATCH] DEVEL15-windows-cellservdb-rank-20090615 LICENSE MIT When inserting a new vldb server, if the rank is 0 (unknown), do not override the default rank assigned by cm_NewServer(). Doing so erases the randomized ranking. (cherry picked from commit 81c9b8c0c4ddf711872104ba6645c1310093af24) --- src/WINNT/afsd/cm_cell.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/WINNT/afsd/cm_cell.c b/src/WINNT/afsd/cm_cell.c index 7c3f74c21e..88783a938d 100644 --- a/src/WINNT/afsd/cm_cell.c +++ b/src/WINNT/afsd/cm_cell.c @@ -54,7 +54,8 @@ long cm_AddCellProc(void *rockp, struct sockaddr_in *addrp, char *hostnamep, uns else tsp = cm_NewServer(addrp, CM_SERVER_VLDB, cellp, NULL, probe ? 0 : CM_FLAG_NOPROBE); - tsp->ipRank = ipRank; + if (ipRank) + tsp->ipRank = ipRank; /* Insert the vlserver into a sorted list, sorted by server rank */ tsrp = cm_NewServerRef(tsp, 0); @@ -138,6 +139,10 @@ cm_cell_t *cm_UpdateCell(cm_cell_t * cp, afs_uint32 flags) } else { lock_ReleaseMutex(&cp->mx); } + + if (code == 0) + cm_RandomizeServer(&cp->vlServersp); + return code ? NULL : cp; }