Windows: buf_Recycle should clean up flags and reset version
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 11 Jan 2010 18:51:42 +0000 (13:51 -0500)
committerJeffrey Altman <jaltman|account-1000011@unknown>
Wed, 13 Jan 2010 05:56:43 +0000 (21:56 -0800)
The CM_BUF_EOF and CM_BUF_ERROR buffer flags and the
buffer dataVersion should be reset within buf_Recycle()
instead of by the caller of buf_Recycle().

LICENSE MIT

Change-Id: I643da102553200b20f5ecc23ec43974581663a8e
Reviewed-on: http://gerrit.openafs.org/1085
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Asanka Herath <asanka@secure-endpoints.com>
Tested-by: Asanka Herath <asanka@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/afsd/cm_buf.c

index acfde34..10c0ea7 100644 (file)
@@ -896,6 +896,10 @@ void buf_Recycle(cm_buf_t *bp)
 
     /* make the fid unrecognizable */
     memset(&bp->fid, 0, sizeof(cm_fid_t));
+
+    /* clean up junk flags */
+    bp->flags &= ~(CM_BUF_EOF | CM_BUF_ERROR);
+    bp->dataVersion = CM_BUF_VERSION_BAD;      /* unknown so far */
 }       
 
 /* recycle a buffer, removing it from the free list, hashing in its new identity
@@ -1030,10 +1034,6 @@ long buf_GetNewLocked(struct cm_scache *scp, osi_hyper_t *offsetp, cm_req_t *req
              */
             buf_Recycle(bp);
 
-            /* clean up junk flags */
-            bp->flags &= ~(CM_BUF_EOF | CM_BUF_ERROR);
-            bp->dataVersion = CM_BUF_VERSION_BAD;      /* unknown so far */
-
             /* now hash in as our new buffer, and give it the
              * appropriate label, if requested.
              */