DEVEL15-windows-store-biod-20070204
authorJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 4 Feb 2007 15:39:14 +0000 (15:39 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 4 Feb 2007 15:39:14 +0000 (15:39 +0000)
Add a 'failed' parameter to the cm_ReleaseBIOD function.  This enables
the clearing of the CM_BUF_DIRTY flag to be conditional upon successful
completion of the store operation.

(cherry picked from commit 333005c46332a9c76974261aef5fdf82c19698b1)

src/WINNT/afsd/cm_daemon.c
src/WINNT/afsd/cm_dcache.c
src/WINNT/afsd/cm_dcache.h

index 8c05d67..c6c351e 100644 (file)
@@ -101,6 +101,8 @@ void cm_BkgDaemon(long parm)
         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
@@ -117,7 +119,10 @@ void cm_BkgDaemon(long parm)
         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:
@@ -130,7 +135,7 @@ void cm_BkgDaemon(long parm)
            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);
        }
     }
index f80f5f5..f1aa3da 100644 (file)
@@ -101,7 +101,7 @@ long cm_BufWrite(void *vscp, osi_hyper_t *offsetp, long length, long flags,
     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;
     }
 
@@ -305,7 +305,7 @@ long cm_BufWrite(void *vscp, osi_hyper_t *offsetp, long length, long flags,
             scp->flags |= CM_SCACHEFLAG_OVERQUOTA;
     }
     lock_ReleaseMutex(&scp->mx);
-    cm_ReleaseBIOD(&biod, 1);
+    cm_ReleaseBIOD(&biod, 1, code);
 
     return code;
 }
@@ -1211,7 +1211,7 @@ long cm_SetupFetchBIOD(cm_scache_t *scp, osi_hyper_t *offsetp,
 /* 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;
@@ -1252,7 +1252,10 @@ void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore)
                    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);
@@ -1342,7 +1345,7 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *up,
             bufp->dataVersion = scp->dataVersion;
         }
         lock_ReleaseMutex(&scp->mx);
-        cm_ReleaseBIOD(&biod, 0);
+        cm_ReleaseBIOD(&biod, 0, 0);
         lock_ObtainMutex(&scp->mx);
         return 0;
     }
@@ -1649,7 +1652,7 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *up,
 
     /* 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) 
index 64bbff6..53741f5 100644 (file)
@@ -37,7 +37,7 @@ extern long cm_CheckFetchRange(cm_scache_t *scp, osi_hyper_t *startBasep,
 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);