DEVEL15-windows-afsd-misc-20080306

LICENSE MIT

(1) an attempt to make better use of bandwidth from the BkgDaemon threads
    by preventing the thread from blocking on a vnode that is already
    storing data in another thread

(2) prevents CM_SCACHEFLAG_ASYNCSTORE from being reset on a write failure.

(3) fixes cm_EvaluateSysName to avoid accessing uninitialized memory

(4) prevents a lock leak if the symlink's mountpointstring is too long.
    (This could never actually happen but better to correct the code.)


(cherry picked from commit 6a631075c478794e998ad67d90e33d304521fbd3)
This commit is contained in:
Jeffrey Altman 2008-03-06 14:34:29 +00:00
parent 8afb0e0b26
commit 82904b8ace
3 changed files with 30 additions and 8 deletions

View File

@ -111,7 +111,8 @@ void cm_BkgDaemon(void * parm)
/* we found a request */
for (rp = cm_bkgListEndp; rp; rp = (cm_bkgRequest_t *) osi_QPrev(&rp->q))
{
if (cm_ServerAvailable(&rp->scp->fid, rp->userp))
if (cm_ServerAvailable(&rp->scp->fid, rp->userp) &&
!(rp->scp->flags & CM_SCACHEFLAG_DATASTORING))
break;
}
if (rp == NULL) {
@ -143,6 +144,10 @@ void cm_BkgDaemon(void * parm)
lock_ObtainWrite(&cm_daemonLock);
/*
* Keep the following list synchronized with the
* error code list in cm_BkgStore
*/
switch ( code ) {
case 0: /* success */
osi_Log1(afsd_logp,"cm_BkgDaemon SUCCESS: request 0x%p", rp);

View File

@ -632,10 +632,25 @@ cm_BkgStore(cm_scache_t *scp, afs_uint32 p1, afs_uint32 p2, afs_uint32 p3, afs_u
osi_Log4(afsd_logp, "Finished BKG store scp 0x%p, offset 0x%x:%08x, code 0x%x", scp, p2, p1, code);
}
lock_ObtainWrite(&scp->rw);
cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_ASYNCSTORE);
lock_ReleaseWrite(&scp->rw);
/*
* Keep the following list synchronized with the
* error code list in cm_BkgDaemon
*/
switch ( code ) {
case CM_ERROR_TIMEDOUT: /* or server restarting */
case CM_ERROR_RETRY:
case CM_ERROR_WOULDBLOCK:
case CM_ERROR_ALLBUSY:
case CM_ERROR_ALLDOWN:
case CM_ERROR_ALLOFFLINE:
case CM_ERROR_PARTIALWRITE:
break; /* cm_BkgDaemon will re-insert the request in the queue */
case 0:
default:
lock_ObtainWrite(&scp->rw);
cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_ASYNCSTORE);
lock_ReleaseWrite(&scp->rw);
}
return code;
}

View File

@ -1410,7 +1410,7 @@ int cm_ExpandSysName(char *inp, char *outp, long outSize, unsigned int index)
if (outp == NULL)
return 1;
if (index >= MAXNUMSYSNAMES)
if (index >= cm_sysNameCount)
return -1;
/* otherwise generate the properly expanded @sys name */
@ -1777,8 +1777,10 @@ long cm_AssembleLink(cm_scache_t *linkScp, char *pathSuffixp,
* being a little conservative here.
*/
if (strlen(linkScp->mountPointStringp) + strlen(pathSuffixp) + 2
>= CM_UTILS_SPACESIZE)
return CM_ERROR_TOOBIG;
>= CM_UTILS_SPACESIZE) {
code = CM_ERROR_TOOBIG;
goto done;
}
tsp = cm_GetSpace();
linkp = linkScp->mountPointStringp;