From 73b91bf0c0a86e55d6879573aeadd99a137ebf3b Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sun, 14 Aug 2011 21:41:47 -0400 Subject: [PATCH] Windows: More interlocked ops for cm_cell flags Change-Id: I9e5cae6152439af75a9baf85900117ca9b456f40 Reviewed-on: http://gerrit.openafs.org/5274 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/cm_ioctl.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/WINNT/afsd/cm_ioctl.c b/src/WINNT/afsd/cm_ioctl.c index 959200e011..a25b8ca7f9 100644 --- a/src/WINNT/afsd/cm_ioctl.c +++ b/src/WINNT/afsd/cm_ioctl.c @@ -1530,8 +1530,8 @@ cm_IoctlNewCell(struct cm_ioctl *ioctlp, struct cm_user *userp) code = cm_SearchCellByDNS(cp->name, cp->name, &ttl, cm_AddCellProc, &rock); if ( code == 0 ) { /* got cell from DNS */ lock_ObtainMutex(&cp->mx); - cp->flags |= CM_CELLFLAG_DNS; - cp->flags &= ~CM_CELLFLAG_VLSERVER_INVALID; + _InterlockedOr(&cp->flags, CM_CELLFLAG_DNS); + _InterlockedAnd(&cp->flags, ~CM_CELLFLAG_VLSERVER_INVALID); cp->timeout = time(0) + ttl; lock_ReleaseMutex(&cp->mx); } @@ -1539,18 +1539,18 @@ cm_IoctlNewCell(struct cm_ioctl *ioctlp, struct cm_user *userp) } else { lock_ObtainMutex(&cp->mx); - cp->flags &= ~CM_CELLFLAG_DNS; + _InterlockedAnd(&cp->flags, ~CM_CELLFLAG_DNS); lock_ReleaseMutex(&cp->mx); } if (code) { lock_ObtainMutex(&cp->mx); - cp->flags |= CM_CELLFLAG_VLSERVER_INVALID; + _InterlockedOr(&cp->flags, CM_CELLFLAG_VLSERVER_INVALID); lock_ReleaseMutex(&cp->mx); lock_ObtainWrite(&cm_cellLock); } else { lock_ObtainMutex(&cp->mx); - cp->flags &= ~CM_CELLFLAG_VLSERVER_INVALID; + _InterlockedAnd(&cp->flags, ~CM_CELLFLAG_VLSERVER_INVALID); lock_ReleaseMutex(&cp->mx); lock_ObtainWrite(&cm_cellLock); cm_RandomizeServer(&cp->vlServersp); @@ -1830,9 +1830,9 @@ cm_IoctlSetCellStatus(struct cm_ioctl *ioctlp, struct cm_user *userp) lock_ObtainMutex(&cellp->mx); if (flags & CM_SETCELLFLAG_SUID) - cellp->flags |= CM_CELLFLAG_SUID; + _InterlockedOr(&cellp->flags, CM_CELLFLAG_SUID); else - cellp->flags &= ~CM_CELLFLAG_SUID; + _InterlockedAnd(&cellp->flags, ~CM_CELLFLAG_SUID); lock_ReleaseMutex(&cellp->mx); return 0;