From 56a82598b19e4232b0095c2b5778d4571c8aa9b2 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 26 Dec 2007 16:18:37 +0000 Subject: [PATCH] windows-callback-restore-multi-cell-servers-20071226 LICENSE MIT The case of openafs.org and grand.central.org is a hideous abuse of the AFS cell name space. There are many negatives associated with trying to support two different cell names pointing at overlapping vlserver lists: (1) The CM can store duplicate entries for all of the data simply because the cell name that was used is different (2) If the CM attempts to optimize the data storage by aliasing or otherwise combining the cell names as part of one cm_cell_t object, then future attempts to separate the two cell names will require the destruction of the cache. (3) If the CM does not associate a callback revoke with a particular cell, then the status data associated with any entry that matches the revoked AFSFid will be discarded. For volume callbacks this can have a serious impact because volume IDs are not unique across cells and discarding status data for readonly volumes that are in use can result in a significant number of FetchStatus requests being sent to the associated file server. There are other issues as well involving authentication. The case of openafs.org advertising the vlserver addresses of grand.central.org should be considered a hack; a hack that the Windows client will no longer ensure will work. Additional debugging messages have been added to assist individuals attempting to debug why callback revokes do not appear to take affect when two cell names share the same vlserver data. --- src/WINNT/afsd/cm_callback.c | 21 ++++++++++++++++----- src/WINNT/afsd/cm_cell.c | 9 ++++++++- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/WINNT/afsd/cm_callback.c b/src/WINNT/afsd/cm_callback.c index d4d28ff80..2212359c7 100644 --- a/src/WINNT/afsd/cm_callback.c +++ b/src/WINNT/afsd/cm_callback.c @@ -355,6 +355,7 @@ SRXAFSCB_CallBack(struct rx_call *callp, AFSCBFids *fidsArrayp, AFSCBs *cbsArray unsigned long host = 0; unsigned short port = 0; cm_server_t *tsp = NULL; + cm_cell_t* cellp = NULL; MUTEX_ENTER(&callp->lock); @@ -362,9 +363,19 @@ SRXAFSCB_CallBack(struct rx_call *callp, AFSCBFids *fidsArrayp, AFSCBs *cbsArray host = rx_HostOf(peerp); port = rx_PortOf(peerp); - osi_Log2(afsd_logp, "SRXAFSCB_CallBack from host 0x%x port %d", - ntohl(host), - ntohs(port)); + tsp = cm_FindServerByIP(host, CM_SERVER_FILE); + if (tsp) + cellp = tsp->cellp; + + if (cellp) + osi_Log2(afsd_logp, "SRXAFSCB_CallBack from host 0x%x port %d", + ntohl(host), + ntohs(port)); + else + osi_Log3(afsd_logp, "SRXAFSCB_CallBack from host 0x%x port %d for cell %s", + ntohl(host), + ntohs(port), + cellp->name /* does not need to be saved, doesn't change */); } else { osi_Log0(afsd_logp, "SRXAFSCB_CallBack from unknown host"); } @@ -376,9 +387,9 @@ SRXAFSCB_CallBack(struct rx_call *callp, AFSCBFids *fidsArrayp, AFSCBs *cbsArray if (tfidp->Volume == 0) continue; /* means don't do anything */ else if (tfidp->Vnode == 0) - cm_RevokeVolumeCallback(callp, NULL, tfidp); + cm_RevokeVolumeCallback(callp, cellp, tfidp); else - cm_RevokeCallback(callp, NULL, tfidp); + cm_RevokeCallback(callp, cellp, tfidp); } MUTEX_EXIT(&callp->lock); diff --git a/src/WINNT/afsd/cm_cell.c b/src/WINNT/afsd/cm_cell.c index 345fc1f5b..3904b1528 100644 --- a/src/WINNT/afsd/cm_cell.c +++ b/src/WINNT/afsd/cm_cell.c @@ -24,7 +24,9 @@ osi_rwlock_t cm_cellLock; /* function called as callback proc from cm_SearchCellFile. Return 0 to - * continue processing. + * continue processing. + * + * At the present time the return value is ignored by the caller. */ long cm_AddCellProc(void *rockp, struct sockaddr_in *addrp, char *namep) { @@ -39,6 +41,10 @@ long cm_AddCellProc(void *rockp, struct sockaddr_in *addrp, char *namep) { if ( !tsp->cellp ) tsp->cellp = cellp; + else if (tsp->cellp != cellp) { + osi_Log2(afsd_logp, "found a vlserver associated with two cell names %s and %s", + osi_LogSaveString(afsd_logp,tsp->cellp->name), osi_LogSaveString(afsd_logp,cellp->name)); + } } else tsp = cm_NewServer(addrp, CM_SERVER_VLDB, cellp); @@ -50,6 +56,7 @@ long cm_AddCellProc(void *rockp, struct sockaddr_in *addrp, char *namep) lock_ObtainWrite(&cm_serverLock); tsrp->refCount--; lock_ReleaseWrite(&cm_serverLock); + return 0; } -- 2.39.5