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 <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
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;