]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
windows-store-biod-20070204
authorJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 4 Feb 2007 15:37:34 +0000 (15:37 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 4 Feb 2007 15:37:34 +0000 (15:37 +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.

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

index 3d96c850ec38198d5e9f1ac9b6e2ef25887fb547..0ab8bd565422e5fa179001ac8b9954e246a949fd 100644 (file)
@@ -95,6 +95,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
@@ -111,7 +113,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:
@@ -124,7 +129,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 501ca8c549e2d701f6a6d91eab3e116c0760c210..dbcd5b79baefc05f51c252df6f0dd7411ac7d601 100644 (file)
@@ -99,7 +99,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;
     }
 
@@ -303,7 +303,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;
 }
@@ -1209,7 +1209,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;
@@ -1250,7 +1250,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);
@@ -1340,7 +1343,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;
     }
@@ -1647,7 +1650,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 64bbff6197aff75f2d35947eecf47f40a135b19d..53741f52a4757807cc844d631e7b3d1122a3a55e 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);