From: Jeffrey Altman Date: Sun, 6 May 2012 01:37:00 +0000 (-0400) Subject: Windows: Track Mixed RO Volume Release State X-Git-Tag: openafs-stable-1_8_0pre1~2441 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=193a56aa664ccfb39a3447f81735f2183a914c76 Windows: Track Mixed RO Volume Release State If the volume location information indicates that a replica site is VLSF_NEWREPSITE then it implies that some of the replicas are out of date. Ignore the out of date replicas when constructing the list and force a volume location list reset every five minutes while the replica site info is mixed. Change-Id: I136e66b1d2da66578970932553d14f59a666721b Reviewed-on: http://gerrit.openafs.org/7354 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- diff --git a/src/WINNT/afsd/cm_volume.c b/src/WINNT/afsd/cm_volume.c index 7416566..2506bb0 100644 --- a/src/WINNT/afsd/cm_volume.c +++ b/src/WINNT/afsd/cm_volume.c @@ -250,6 +250,7 @@ long cm_UpdateVolumeLocation(struct cm_cell *cellp, cm_user_t *userp, cm_req_t * struct uvldbentry uvldbEntry; int method = -1; int ROcount = 0; + int isMixed = 0; long code; enum volstatus rwNewstate = vl_online; enum volstatus roNewstate = vl_online; @@ -548,6 +549,15 @@ long cm_UpdateVolumeLocation(struct cm_cell *cellp, cm_user_t *userp, cm_req_t * volp->vol[BACKVOL].ID = 0; } lock_ReleaseWrite(&cm_volumeLock); + + /* See if the replica sites are mixed versions */ + for (i=0; iflags & CM_SERVERFLAG_DOWN)) rwServers_alldown = 0; } - if ((tflags & VLSF_ROVOL) && (flags & VLF_ROEXISTS)) { + /* + * If there are mixed versions of RO releases on the replica + * sites, skip the servers with the out of date versions. + */ + if ((tflags & VLSF_ROVOL) && (flags & VLF_ROEXISTS) && + (!isMixed || (tflags & VLSF_NEWREPSITE))) { tsrp = cm_NewServerRef(tsp, roID); cm_InsertServerList(&volp->vol[ROVOL].serversp, tsrp); ROcount++; @@ -683,6 +698,10 @@ long cm_UpdateVolumeLocation(struct cm_cell *cellp, cm_user_t *userp, cm_req_t * } volp->lastUpdateTime = time(NULL); + if (isMixed) + _InterlockedOr(&volp->flags, CM_VOLUMEFLAG_RO_MIXED); + else + _InterlockedAnd(&volp->flags, ~CM_VOLUMEFLAG_RO_MIXED); if (code == 0) _InterlockedAnd(&volp->flags, ~CM_VOLUMEFLAG_RESET); @@ -1211,9 +1230,16 @@ void cm_RefreshVolumes(int lifetime) if (!(volp->flags & CM_VOLUMEFLAG_RESET)) { lock_ObtainWrite(&volp->rw); - if (volp->lastUpdateTime + lifetime <= now) { - _InterlockedOr(&volp->flags, CM_VOLUMEFLAG_RESET); - volp->lastUpdateTime = 0; + if (volp->flags & CM_VOLUMEFLAG_RO_MIXED) { + if (volp->lastUpdateTime + 300 <= now) { + _InterlockedOr(&volp->flags, CM_VOLUMEFLAG_RESET); + volp->lastUpdateTime = 0; + } + } else { + if (volp->lastUpdateTime + lifetime <= now) { + _InterlockedOr(&volp->flags, CM_VOLUMEFLAG_RESET); + volp->lastUpdateTime = 0; + } } lock_ReleaseWrite(&volp->rw); } diff --git a/src/WINNT/afsd/cm_volume.h b/src/WINNT/afsd/cm_volume.h index a308ca8..d843d87 100644 --- a/src/WINNT/afsd/cm_volume.h +++ b/src/WINNT/afsd/cm_volume.h @@ -56,6 +56,7 @@ typedef struct cm_volume { } cm_volume_t; #define CM_VOLUMEFLAG_RESET 1 /* reload this info on next use */ +#define CM_VOLUMEFLAG_RO_MIXED 2 #define CM_VOLUMEFLAG_UPDATING_VL 8 #define CM_VOLUMEFLAG_DFS_VOLUME 16 #define CM_VOLUMEFLAG_NOEXIST 32