From 7940ab94a87da7799c4d1e7910fdc485433cac87 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 14 Jun 2007 21:58:53 +0000 Subject: [PATCH] DEVEL15-windows-ioctl-path-availability-20070614 fix cm_IoctlPathAvailability to return the current volume state. 0, CM_ERROR_ALLBUSY, CM_ERROR_ALLDOWN, CM_ERROR_ALLOFFLINE modify fs.c to generate messages when the errors are received. (cherry picked from commit e8fa4d0e40c2a4352010986f82ac2fbfe8b8ae3e) --- src/WINNT/afsd/cm_ioctl.c | 33 +++++++++++++++++++++++++-------- src/WINNT/afsd/fs.c | 22 ++++++++++++++++++++-- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/src/WINNT/afsd/cm_ioctl.c b/src/WINNT/afsd/cm_ioctl.c index 9b14264b25..ab894375fd 100644 --- a/src/WINNT/afsd/cm_ioctl.c +++ b/src/WINNT/afsd/cm_ioctl.c @@ -2829,8 +2829,8 @@ long cm_IoctlPathAvailability(struct smb_ioctl *ioctlp, struct cm_user *userp) cm_scache_t *scp; cm_cell_t *cellp; cm_volume_t *tvp; - cm_serverRef_t **tsrpp; - unsigned long volume; + cm_vol_state_t *statep; + afs_uint32 volume; cm_req_t req; cm_InitReq(&req); @@ -2852,13 +2852,30 @@ long cm_IoctlPathAvailability(struct smb_ioctl *ioctlp, struct cm_user *userp) if (code) return code; - lock_ObtainMutex(&tvp->mx); - tsrpp = cm_GetVolServers(tvp, volume); - code = cm_CheckServersStatus(*tsrpp); - cm_FreeServerList(tsrpp, 0); - lock_ReleaseMutex(&tvp->mx); + if (volume == tvp->rw.ID) + statep = &tvp->rw; + else if (volume == tvp->ro.ID) + statep = &tvp->ro; + else + statep = &tvp->bk; + + switch (statep->state) { + case vl_online: + case vl_unknown: + code = 0; + break; + case vl_busy: + code = CM_ERROR_ALLBUSY; + break; + case vl_offline: + code = CM_ERROR_ALLOFFLINE; + break; + case vl_alldown: + code = CM_ERROR_ALLDOWN; + break; + } cm_PutVolume(tvp); - return 0; + return code; } diff --git a/src/WINNT/afsd/fs.c b/src/WINNT/afsd/fs.c index 6c012f5baa..fafeacd37c 100644 --- a/src/WINNT/afsd/fs.c +++ b/src/WINNT/afsd/fs.c @@ -4639,10 +4639,10 @@ Die(int code, char *filename) else if (code == ENODEV) { fprintf(stderr,"%s: AFS service may not have started.\n", pn); } - else if (code == ESRCH) { + else if (code == ESRCH) { /* hack */ fprintf(stderr,"%s: Cell name not recognized.\n", pn); } - else if (code == EPIPE) { + else if (code == EPIPE) { /* hack */ fprintf(stderr,"%s: Volume name or ID not recognized.\n", pn); } else if (code == EFBIG) { @@ -4654,6 +4654,24 @@ Die(int code, char *filename) else fprintf(stderr,"%s: Connection timed out", pn); } + else if (code == EBUSY) { + if (filename) + fprintf(stderr,"%s: All servers are busy on which '%s' resides\n", pn, filename); + else + fprintf(stderr,"%s: All servers are busy\n", pn); + } + else if (code == ENXIO) { + if (filename) + fprintf(stderr,"%s: All volume instances are offline on which '%s' resides\n", pn, filename); + else + fprintf(stderr,"%s: All volume instances are offline\n", pn); + } + else if (code == ENOSYS) { + if (filename) + fprintf(stderr,"%s: All servers are down on which '%s' resides\n", pn, filename); + else + fprintf(stderr,"%s: All servers are down\n", pn); + } else { if (filename) fprintf(stderr,"%s:'%s'", pn, filename);