From: Jeffrey Altman Date: Mon, 15 Aug 2011 01:41:47 +0000 (-0400) Subject: Windows: More interlocked ops for cm_cell flags X-Git-Tag: upstream/1.8.0_pre1^2~3388 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=73b91bf0c0a86e55d6879573aeadd99a137ebf3b;p=packages%2Fo%2Fopenafs.git 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 --- diff --git a/src/WINNT/afsd/cm_ioctl.c b/src/WINNT/afsd/cm_ioctl.c index 959200e01..a25b8ca7f 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;