osi_assert(cm_bkgQueueCount-- > 0);
lock_ReleaseWrite(&cm_daemonLock);
+ osi_Log1(afsd_logp,"cm_BkgDaemon processing request 0x%p", rp);
+
#ifdef DEBUG_REFCOUNT
osi_Log2(afsd_logp,"cm_BkgDaemon (before) scp 0x%x ref %d",rp->scp, rp->scp->refCount);
#endif
lock_ObtainWrite(&cm_daemonLock);
switch ( code ) {
- case CM_ERROR_TIMEDOUT:
+ case 0: /* success */
+ osi_Log1(afsd_logp,"cm_BkgDaemon SUCCESS: request 0x%p", rp);
+ break;
+ case CM_ERROR_TIMEDOUT: /* or server restarting */
case CM_ERROR_RETRY:
case CM_ERROR_WOULDBLOCK:
case CM_ERROR_ALLBUSY:
osi_QAddT((osi_queue_t **) &cm_bkgListp, (osi_queue_t **)&cm_bkgListEndp, &rp->q);
break;
default:
- osi_Log2(afsd_logp,"cm_BkgDaemon failed request dropped 0x%p code 0x%x",
+ osi_Log2(afsd_logp,"cm_BkgDaemon FAILED: request dropped 0x%p code 0x%x",
rp, code);
}
}
if (biod.length == 0) {
osi_Log0(afsd_logp, "cm_SetupStoreBIOD length 0");
lock_ReleaseMutex(&scp->mx);
- cm_ReleaseBIOD(&biod, 1); /* should be a NOOP */
+ cm_ReleaseBIOD(&biod, 1, 0); /* should be a NOOP */
return 0;
}
scp->flags |= CM_SCACHEFLAG_OVERQUOTA;
}
lock_ReleaseMutex(&scp->mx);
- cm_ReleaseBIOD(&biod, 1);
+ cm_ReleaseBIOD(&biod, 1, code);
return code;
}
/* release a bulk I/O structure that was setup by cm_SetupFetchBIOD or by
* cm_SetupStoreBIOD
*/
-void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore)
+void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore, int failed)
{
cm_scache_t *scp; /* do not release; not held in biop */
cm_buf_t *bufp;
osi_Log2(afsd_logp, "cm_ReleaseBIOD Waking [scp 0x%p] bp 0x%p", scp, bufp);
osi_Wakeup((LONG_PTR) bufp);
}
- bufp->flags &= ~(CM_BUF_WRITING | CM_BUF_DIRTY);
+ if (failed)
+ bufp->flags &= ~CM_BUF_WRITING;
+ else
+ bufp->flags &= ~(CM_BUF_WRITING | CM_BUF_DIRTY);
}
lock_ReleaseMutex(&scp->mx);
bufp->dataVersion = scp->dataVersion;
}
lock_ReleaseMutex(&scp->mx);
- cm_ReleaseBIOD(&biod, 0);
+ cm_ReleaseBIOD(&biod, 0, 0);
lock_ObtainMutex(&scp->mx);
return 0;
}
/* release scatter/gather I/O structure (buffers, locks) */
lock_ReleaseMutex(&scp->mx);
- cm_ReleaseBIOD(&biod, 0);
+ cm_ReleaseBIOD(&biod, 0, code);
lock_ObtainMutex(&scp->mx);
if (code == 0)
extern long cm_SetupFetchBIOD(cm_scache_t *scp, osi_hyper_t *offsetp,
cm_bulkIO_t *biop, cm_user_t *up, cm_req_t *reqp);
-extern void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore);
+extern void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore, int failed);
extern long cm_SetupStoreBIOD(cm_scache_t *scp, osi_hyper_t *inOffsetp,
long inSize, cm_bulkIO_t *biop, cm_user_t *userp, cm_req_t *reqp);