From 78f99d4a025d3b369d3ad4939098ea868feb6cfc Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 31 Jul 2010 00:05:24 -0400 Subject: [PATCH] Windows: Update root.afs scache dv when Freelance dir bufs are regenerated When the contents of the Freelance root directory changes the fake directory buffers are updated and a fakeDirVersion is incremented. The dataVersion of the cm_scache_t object is supposed to be updated on the next access by performing a fake get callback request. Unfortunately, this did not always occur because of a race. If another Freelance object is updated first, the root directory object would never successfully get a fake callback. This patchset ensures that the generation of the fake directory buffer content and the callback are obtained under the same set of locks thereby removing the race. LICENSE MIT Change-Id: Ic8c77fc3c652cd056f84db55ca6db32499bcb0c9 Reviewed-on: http://gerrit.openafs.org/2490 Tested-by: Jeffrey Altman Reviewed-by: Derrick Brashear Reviewed-by: Jeffrey Altman --- src/WINNT/afsd/cm_freelance.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/WINNT/afsd/cm_freelance.c b/src/WINNT/afsd/cm_freelance.c index fb0be302e..286887847 100644 --- a/src/WINNT/afsd/cm_freelance.c +++ b/src/WINNT/afsd/cm_freelance.c @@ -408,6 +408,9 @@ int cm_reInitLocalMountPoints() { cm_fid_t aFid; unsigned int i, hash; cm_scache_t *scp, **lscpp, *tscp; + cm_req_t req; + + cm_InitReq(&req); osi_Log0(afsd_logp,"----- freelance reinitialization starts ----- "); @@ -456,8 +459,11 @@ int cm_reInitLocalMountPoints() { } } lock_ReleaseWrite(&cm_scacheLock); + lock_ReleaseMutex(&cm_Freelance_Lock); osi_Log0(afsd_logp,"\tall old scp cleared!"); + lock_ObtainWrite(&cm_data.rootSCachep->rw); + lock_ObtainMutex(&cm_Freelance_Lock); // we must free the memory that was allocated in the prev // cm_InitLocalMountPoints call osi_Log0(afsd_logp,"Removing old localmountpoints... "); @@ -478,6 +484,9 @@ int cm_reInitLocalMountPoints() { lock_ReleaseMutex(&cm_Freelance_Lock); + cm_GetCallback(cm_data.rootSCachep, cm_rootUserp, &req, 0); + lock_ReleaseWrite(&cm_data.rootSCachep->rw); + osi_Log0(afsd_logp,"----- freelance reinit complete -----"); return 0; } -- 2.39.5