From: Jeffrey Altman Date: Fri, 16 Oct 2009 19:31:02 +0000 (-0400) Subject: Windows: mark volume status online during cm_MergeStatus X-Git-Tag: openafs-devel-1_5_66~55 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=2285341b5f009329d84f1ccdb6bcadcb6a507047;p=packages%2Fo%2Fopenafs.git Windows: mark volume status online during cm_MergeStatus During cm_MergeStatus, if the volume status is not vl_online mark it vl_online. The volume must be online because an AFSFetchStatus was just processed. This change reduces the amount of work that must be performed by the daemon thread's volume status check. LICENSE MIT Reviewed-on: http://gerrit.openafs.org/669 Tested-by: Jeffrey Altman Reviewed-by: Jeffrey Altman --- diff --git a/src/WINNT/afsd/cm_scache.c b/src/WINNT/afsd/cm_scache.c index 9028d8c5d..bee91c490 100644 --- a/src/WINNT/afsd/cm_scache.c +++ b/src/WINNT/afsd/cm_scache.c @@ -1514,6 +1514,8 @@ void cm_MergeStatus(cm_scache_t *dscp, cm_user_t *userp, cm_req_t *reqp, afs_uint32 flags) { afs_uint64 dataVersion; + struct cm_volume *volp = NULL; + struct cm_cell *cellp = NULL; // yj: i want to create some fake status for the /afs directory and the // entries under that directory @@ -1579,7 +1581,7 @@ void cm_MergeStatus(cm_scache_t *dscp, scp->parentVnode = 0; scp->parentUnique = 0; } - return; + goto done; } else { scp->flags &= ~CM_SCACHEFLAG_EACCESS; } @@ -1591,18 +1593,14 @@ void cm_MergeStatus(cm_scache_t *dscp, if (!(flags & CM_MERGEFLAG_FORCE) && dataVersion < scp->dataVersion && scp->dataVersion != CM_SCACHE_VERSION_BAD) { - struct cm_cell *cellp; cellp = cm_FindCellByID(scp->fid.cell, 0); if (scp->cbServerp) { - struct cm_volume *volp = NULL; cm_FindVolumeByID(cellp, scp->fid.volume, userp, reqp, CM_GETVOL_FLAG_CREATE, &volp); osi_Log2(afsd_logp, "old data from server %x volume %s", scp->cbServerp->addr.sin_addr.s_addr, volp ? volp->namep : "(unknown)"); - if (volp) - cm_PutVolume(volp); } osi_Log3(afsd_logp, "Bad merge, scp %x, scp dv %d, RPC dv %d", scp, scp->dataVersion, dataVersion); @@ -1634,7 +1632,7 @@ void cm_MergeStatus(cm_scache_t *dscp, * infinite loop. So we just grin and bear it. */ if (!(scp->flags & CM_SCACHEFLAG_RO)) - return; + goto done; } scp->volumeCreationDate = volsyncp->spare1; /* volume creation date */ @@ -1766,6 +1764,29 @@ void cm_MergeStatus(cm_scache_t *dscp, * have completed yet. */ cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_FETCHSTATUS); + + /* + * We just successfully merged status on the stat cache object. + * This means that the associated volume must be online. + */ + if (!volp) { + if (!cellp) + cellp = cm_FindCellByID(scp->fid.cell, 0); + cm_FindVolumeByID(cellp, scp->fid.volume, userp, reqp, 0, &volp); + } + if (volp) { + cm_vol_state_t *statep = cm_VolumeStateByID(volp, scp->fid.volume); + if (statep->state != vl_online) { + lock_ObtainWrite(&volp->rw); + cm_VolumeStatusNotification(volp, statep->ID, statep->state, vl_online); + statep->state = vl_online; + lock_ReleaseWrite(&volp->rw); + } + } + done: + if (volp) + cm_PutVolume(volp); + } /* note that our stat cache info is incorrect, so force us eventually