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
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>
(cherry picked from commit
33af0f92e9b8a50c5a6dd17a9065c0ef58597c28)
Change-Id: Id92298fa848becb4131139579fd31b0c5f98a4ad
Reviewed-on: http://gerrit.openafs.org/6032
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
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;