From 0cd87a33359889736c5279239e0334743e8a2d9a Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 7 Feb 2008 06:14:59 +0000 Subject: [PATCH] DEVEL15-windows-volstat-20080206 LICENSE MIT Ensure that the volume status is always updated after a server_ref status change. (cherry picked from commit 04cac1963a4716e57447b28c00629f0ef5a15258) --- src/WINNT/afsd/cm_conn.c | 25 ++++++++++++++++++++++--- src/WINNT/afsd/cm_volume.c | 12 ++++++------ 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/WINNT/afsd/cm_conn.c b/src/WINNT/afsd/cm_conn.c index 13f8dcbc27..69697d440b 100644 --- a/src/WINNT/afsd/cm_conn.c +++ b/src/WINNT/afsd/cm_conn.c @@ -393,6 +393,8 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, statep = &volp->ro; else if (fidp->volume == volp->bk.ID) statep = &volp->bk; + + cm_UpdateVolumeStatus(volp, statep->ID); } cm_PutVolume(volp); @@ -485,11 +487,28 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, /* REDIRECT */ if (errorCode == VMOVED) { tsrp->status = srv_deleted; - if (fidp) { + if (fidp) cm_ForceUpdateVolume(fidp, userp, reqp); - } - } else + } else { tsrp->status = srv_offline; + } + + if (fidp) { /* File Server query */ + code = cm_GetVolumeByID(cellp, fidp->volume, userp, reqp, + CM_GETVOL_FLAG_NO_LRU_UPDATE, + &volp); + if (code == 0) { + if (fidp->volume == volp->rw.ID) + statep = &volp->rw; + else if (fidp->volume == volp->ro.ID) + statep = &volp->ro; + else if (fidp->volume == volp->bk.ID) + statep = &volp->bk; + + cm_UpdateVolumeStatus(volp, statep->ID); + } + cm_PutVolume(volp); + } } } if (free_svr_list) { diff --git a/src/WINNT/afsd/cm_volume.c b/src/WINNT/afsd/cm_volume.c index 9d6c01768a..f348d468c5 100644 --- a/src/WINNT/afsd/cm_volume.c +++ b/src/WINNT/afsd/cm_volume.c @@ -1022,7 +1022,7 @@ cm_CheckOfflineVolume(cm_volume_t *volp, afs_uint32 volID) serversp->status = srv_not_busy; } - lock_ReleaseMutex(&volp->mx); + lock_ReleaseMutex(&volp->mx); do { code = cm_ConnFromVolume(volp, volp->rw.ID, cm_rootUserp, &req, &connp); if (code) @@ -1036,7 +1036,7 @@ cm_CheckOfflineVolume(cm_volume_t *volp, afs_uint32 volID) } while (cm_Analyze(connp, cm_rootUserp, &req, NULL, NULL, NULL, NULL, code)); code = cm_MapRPCError(code, &req); - lock_ObtainMutex(&volp->mx); + lock_ObtainMutex(&volp->mx); if (code == 0 && volStat.Online) { cm_VolumeStatusNotification(volp, volp->rw.ID, volp->rw.state, vl_online); volp->rw.state = vl_online; @@ -1057,7 +1057,7 @@ cm_CheckOfflineVolume(cm_volume_t *volp, afs_uint32 volID) serversp->status = srv_not_busy; } - lock_ReleaseMutex(&volp->mx); + lock_ReleaseMutex(&volp->mx); do { code = cm_ConnFromVolume(volp, volp->ro.ID, cm_rootUserp, &req, &connp); if (code) @@ -1071,7 +1071,7 @@ cm_CheckOfflineVolume(cm_volume_t *volp, afs_uint32 volID) } while (cm_Analyze(connp, cm_rootUserp, &req, NULL, NULL, NULL, NULL, code)); code = cm_MapRPCError(code, &req); - lock_ObtainMutex(&volp->mx); + lock_ObtainMutex(&volp->mx); if (code == 0 && volStat.Online) { cm_VolumeStatusNotification(volp, volp->ro.ID, volp->ro.state, vl_online); volp->ro.state = vl_online; @@ -1092,7 +1092,7 @@ cm_CheckOfflineVolume(cm_volume_t *volp, afs_uint32 volID) serversp->status = srv_not_busy; } - lock_ReleaseMutex(&volp->mx); + lock_ReleaseMutex(&volp->mx); do { code = cm_ConnFromVolume(volp, volp->bk.ID, cm_rootUserp, &req, &connp); if (code) @@ -1106,7 +1106,7 @@ cm_CheckOfflineVolume(cm_volume_t *volp, afs_uint32 volID) } while (cm_Analyze(connp, cm_rootUserp, &req, NULL, NULL, NULL, NULL, code)); code = cm_MapRPCError(code, &req); - lock_ObtainMutex(&volp->mx); + lock_ObtainMutex(&volp->mx); if (code == 0 && volStat.Online) { cm_VolumeStatusNotification(volp, volp->bk.ID, volp->bk.state, vl_online); volp->bk.state = vl_online;