mirror of
https://git.openafs.org/openafs.git
synced 2025-01-20 16:00:12 +00:00
windows-get-volume-no-reset-flag-20080124
LICENSE MIT There are circumstances where a volume object is being accessed and the volume is marked indicating that the volume location information is out of date but where it is also pointless and perhaps dangerous to block waiting for the rpc to complete. One example is when processing the cmdebug requests. If we know that we are not going to use the volume object to contact a server, then we can now set the CM_GETVOL_FLAG_NO_RESET flag.
This commit is contained in:
parent
16a90b2f8d
commit
d32156e5c1
@ -1968,6 +1968,7 @@ cm_GiveUpAllCallbacks(cm_server_t *tsp, afs_int32 markDown)
|
||||
tsp->downTime = osi_Time();
|
||||
}
|
||||
cm_ForceNewConnections(tsp);
|
||||
|
||||
/* Now update the volume status */
|
||||
for (tsrvp = tsp->vols; tsrvp; tsrvp = tsrvp->nextp) {
|
||||
for (i=0; i<NUM_SERVER_VOLS; i++) {
|
||||
@ -1977,7 +1978,7 @@ cm_GiveUpAllCallbacks(cm_server_t *tsp, afs_int32 markDown)
|
||||
cm_InitReq(&req);
|
||||
|
||||
code = cm_GetVolumeByID(tsp->cellp, tsrvp->ids[i], cm_rootUserp,
|
||||
&req, CM_GETVOL_FLAG_NO_LRU_UPDATE, &volp);
|
||||
&req, CM_GETVOL_FLAG_NO_LRU_UPDATE | CM_GETVOL_FLAG_NO_RESET, &volp);
|
||||
if (code == 0) {
|
||||
cm_UpdateVolumeStatus(volp, tsrvp->ids[i]);
|
||||
cm_PutVolume(volp);
|
||||
|
@ -613,25 +613,27 @@ long cm_GetVolumeByID(cm_cell_t *cellp, afs_uint32 volumeID, cm_user_t *userp,
|
||||
|
||||
/* return it held */
|
||||
if (volp) {
|
||||
lock_ObtainMutex(&volp->mx);
|
||||
lock_ObtainMutex(&volp->mx);
|
||||
|
||||
code = 0;
|
||||
if (volp->flags & CM_VOLUMEFLAG_RESET) {
|
||||
code = cm_UpdateVolume(cellp, userp, reqp, volp);
|
||||
if (code == 0)
|
||||
volp->flags &= ~CM_VOLUMEFLAG_RESET;
|
||||
}
|
||||
lock_ReleaseMutex(&volp->mx);
|
||||
if (code == 0) {
|
||||
*outVolpp = volp;
|
||||
code = 0;
|
||||
if ((volp->flags & CM_VOLUMEFLAG_RESET) && !(flags & CM_GETVOL_FLAG_NO_RESET)) {
|
||||
code = cm_UpdateVolume(cellp, userp, reqp, volp);
|
||||
if (code == 0)
|
||||
volp->flags &= ~CM_VOLUMEFLAG_RESET;
|
||||
}
|
||||
lock_ReleaseMutex(&volp->mx);
|
||||
if (code == 0) {
|
||||
*outVolpp = volp;
|
||||
|
||||
lock_ObtainWrite(&cm_volumeLock);
|
||||
cm_AdjustVolumeLRU(volp);
|
||||
lock_ReleaseWrite(&cm_volumeLock);
|
||||
if (!(flags & CM_GETVOL_FLAG_NO_LRU_UPDATE)) {
|
||||
lock_ObtainWrite(&cm_volumeLock);
|
||||
cm_AdjustVolumeLRU(volp);
|
||||
lock_ReleaseWrite(&cm_volumeLock);
|
||||
}
|
||||
} else
|
||||
cm_PutVolume(volp);
|
||||
cm_PutVolume(volp);
|
||||
|
||||
return code;
|
||||
return code;
|
||||
}
|
||||
|
||||
/* otherwise, we didn't find it so consult the VLDB */
|
||||
@ -780,10 +782,10 @@ long cm_GetVolumeByName(struct cm_cell *cellp, char *volumeNamep,
|
||||
}
|
||||
|
||||
/* if we get here we are holding the mutex */
|
||||
if (volp->flags & CM_VOLUMEFLAG_RESET) {
|
||||
code = cm_UpdateVolume(cellp, userp, reqp, volp);
|
||||
if (code == 0)
|
||||
volp->flags &= ~CM_VOLUMEFLAG_RESET;
|
||||
if ((volp->flags & CM_VOLUMEFLAG_RESET) && !(flags & CM_GETVOL_FLAG_NO_RESET)) {
|
||||
code = cm_UpdateVolume(cellp, userp, reqp, volp);
|
||||
if (code == 0)
|
||||
volp->flags &= ~CM_VOLUMEFLAG_RESET;
|
||||
}
|
||||
lock_ReleaseMutex(&volp->mx);
|
||||
|
||||
@ -792,13 +794,15 @@ long cm_GetVolumeByName(struct cm_cell *cellp, char *volumeNamep,
|
||||
code = CM_ERROR_NOSUCHVOLUME;
|
||||
|
||||
if (code == 0) {
|
||||
*outVolpp = volp;
|
||||
|
||||
lock_ObtainWrite(&cm_volumeLock);
|
||||
cm_AdjustVolumeLRU(volp);
|
||||
lock_ReleaseWrite(&cm_volumeLock);
|
||||
*outVolpp = volp;
|
||||
|
||||
if (!(flags & CM_GETVOL_FLAG_NO_LRU_UPDATE)) {
|
||||
lock_ObtainWrite(&cm_volumeLock);
|
||||
cm_AdjustVolumeLRU(volp);
|
||||
lock_ReleaseWrite(&cm_volumeLock);
|
||||
}
|
||||
} else
|
||||
cm_PutVolume(volp);
|
||||
cm_PutVolume(volp);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ extern long cm_GetVolumeByID(struct cm_cell *cellp, afs_uint32 volumeID,
|
||||
|
||||
#define CM_GETVOL_FLAG_CREATE 1
|
||||
#define CM_GETVOL_FLAG_NO_LRU_UPDATE 2
|
||||
#define CM_GETVOL_FLAG_NO_RESET 4
|
||||
|
||||
/* hash define. Must not include the cell, since the callback revocation code
|
||||
* doesn't necessarily know the cell in the case of a multihomed server
|
||||
|
Loading…
Reference in New Issue
Block a user