From c32f5466f0cf7150d8bbe286fa51834108dce63f Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 8 Mar 2008 23:15:54 +0000 Subject: [PATCH] windows-performance-deadlock-20080308 LICENSE MIT correct a deadlock when calling HaveCallback --- src/WINNT/afsd/cm_performance.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/WINNT/afsd/cm_performance.c b/src/WINNT/afsd/cm_performance.c index f3f4e87a9e..ef404cc29b 100644 --- a/src/WINNT/afsd/cm_performance.c +++ b/src/WINNT/afsd/cm_performance.c @@ -103,8 +103,10 @@ void cm_PerformanceAddSCache(cm_scache_t *scp) statp->fileLength = scp->length; statp->fileType = scp->fileType; statp->flags = CM_FIDSTATS_FLAG_HAVE_SCACHE; + lock_ConvertRToW(&scp->rw); if (cm_HaveCallback(scp)) statp->flags |= CM_FIDSTATS_FLAG_CALLBACK; + lock_ConvertWToR(&scp->rw); if (scp->flags & CM_SCACHEFLAG_RO) statp->flags |= CM_FIDSTATS_FLAG_RO; if (scp->flags & CM_SCACHEFLAG_PURERO) @@ -160,7 +162,9 @@ void cm_PerformanceTuningInit(void) for (scp=cm_data.scacheHashTablep[i]; scp; scp=scp->nextp) { if (scp->fid.cell == 0) continue; + lock_ReleaseRead(&cm_scacheLock); cm_PerformanceAddSCache(scp); + lock_ObtainRead(&cm_scacheLock); } } lock_ReleaseRead(&cm_scacheLock); @@ -296,8 +300,11 @@ void cm_PerformanceTuningCheck(void) break; } } - if (!statp) + if (!statp) { + lock_ReleaseRead(&cm_scacheLock); cm_PerformanceAddSCache(scp); + lock_ObtainRead(&cm_scacheLock); + } } } lock_ReleaseRead(&cm_scacheLock);