From 33af0f92e9b8a50c5a6dd17a9065c0ef58597c28 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 5 Sep 2011 10:11:09 -0400 Subject: [PATCH] Windows: use lock conversion in cm_EndDirOp Instead of dropping the lock for read and reacquiring for write use lock_ConvertRToW() which will make the change atomicly if it is possible or place the thread into the wait list if not. LICENSE MIT Change-Id: I5d134f045a0c935fdaaef6edf5bdf37bb0418a98 Reviewed-on: http://gerrit.openafs.org/5360 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/cm_dir.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/WINNT/afsd/cm_dir.c b/src/WINNT/afsd/cm_dir.c index cad2cfe9ed..1c2271b771 100644 --- a/src/WINNT/afsd/cm_dir.c +++ b/src/WINNT/afsd/cm_dir.c @@ -1209,8 +1209,9 @@ cm_EndDirOp(cm_dirOp_t * op) switch (op->lockType) { case CM_DIRLOCK_READ: - lock_ReleaseRead(&op->scp->dirlock); - /* fall through ... */ + lock_ConvertRToW(&op->scp->dirlock); + op->lockType = CM_DIRLOCK_WRITE; + break; case CM_DIRLOCK_NONE: lock_ObtainWrite(&op->scp->dirlock); op->lockType = CM_DIRLOCK_WRITE;