DEVEL15-windows-buf-flush-20061109
authorJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 9 Nov 2006 21:26:51 +0000 (21:26 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 9 Nov 2006 21:26:51 +0000 (21:26 +0000)
FIXES 44330

The return value of buf_CleanAsync is not an error value but a flag
indicating whether or not the buffer was in fact dirty.  Do not treat
it as an error.  The error state is stored in the buffer itself.

(cherry picked from commit 398ceb0775a0663829ce4c44a8ec08d9e63bd1ca)

src/WINNT/afsd/cm_buf.c

index ca1d7e0..1fd19bf 100644 (file)
@@ -1470,14 +1470,14 @@ long buf_FlushCleanPages(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp)
 
 long buf_CleanVnode(struct cm_scache *scp, cm_user_t *userp, cm_req_t *reqp)
 {
-    long code;
+    long code = 0;
+    long wasDirty = 0;
     cm_buf_t *bp;              /* buffer we're hacking on */
     cm_buf_t *nbp;             /* next one */
     long i;
 
     i = BUF_FILEHASH(&scp->fid);
 
-    code = 0;
     lock_ObtainWrite(&buf_globalLock);
     bp = cm_data.buf_fileHashTablepp[i];
     if (bp) 
@@ -1494,12 +1494,11 @@ long buf_CleanVnode(struct cm_scache *scp, cm_user_t *userp, cm_req_t *reqp)
                 bp->userp = userp;
                 lock_ReleaseMutex(&bp->mx);
             }   
-            code = buf_CleanAsync(bp, reqp);
+            wasDirty = buf_CleanAsync(bp, reqp);
            buf_CleanWait(scp, bp);
             lock_ObtainMutex(&bp->mx);
             if (bp->flags & CM_BUF_ERROR) {
-                if (code == 0 || code == -1) 
-                    code = bp->error;
+               code = bp->error;
                 if (code == 0) 
                     code = -1;
             }