Windows: Do not reset cm_buf.offset on error
authorJeffrey Altman <jaltman@your-file-system.com>
Tue, 13 Nov 2012 22:59:06 +0000 (17:59 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Wed, 14 Nov 2012 04:12:43 +0000 (20:12 -0800)
When an error occurs the cm_buf_t is not removed from the
hash tables.  Since the scacheHashTable hash is built from
the fid and the offset it is not safe to reset the offset field.
Resetting the offset field results in an assertion failure
during buffer recycling.

Change-Id: Id33ec048f8ecfd7f715feafadfa4ea618cdbac0d
Reviewed-on: http://gerrit.openafs.org/8452
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsd/cm_buf.c
src/WINNT/afsd/cm_dcache.c

index 58a7891..96b5a70 100644 (file)
@@ -858,7 +858,6 @@ afs_uint32 buf_CleanLocked(cm_scache_t *scp, cm_buf_t *bp, cm_req_t *reqp,
             code == CM_ERROR_READONLY || code == CM_ERROR_NOSUCHPATH || code == EIO){
            _InterlockedAnd(&bp->flags, ~CM_BUF_DIRTY);
            _InterlockedOr(&bp->flags, CM_BUF_ERROR);
-            bp->dirty_offset = 0;
             bp->dirty_length = 0;
            bp->error = code;
            bp->dataVersion = CM_BUF_VERSION_BAD;
@@ -1968,7 +1967,6 @@ long buf_Truncate(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp,
                 }
                 _InterlockedAnd(&bufp->flags, ~CM_BUF_DIRTY);
                 bufp->error = 0;
-                bufp->dirty_offset = 0;
                 bufp->dirty_length = 0;
                 bufp->dataVersion = CM_BUF_VERSION_BAD;        /* known bad */
                 bufp->dirtyCounter++;
@@ -2066,7 +2064,6 @@ long buf_FlushCleanPages(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp)
                 _InterlockedAnd(&bp->flags, ~CM_BUF_DIRTY);
                 _InterlockedOr(&bp->flags, CM_BUF_ERROR);
                 bp->error = CM_ERROR_BADFD;
-                bp->dirty_offset = 0;
                 bp->dirty_length = 0;
                 bp->dataVersion = CM_BUF_VERSION_BAD;  /* known bad */
                 bp->dirtyCounter++;
@@ -2245,7 +2242,6 @@ long buf_CleanVnode(struct cm_scache *scp, cm_user_t *userp, cm_req_t *reqp)
                      */
                     _InterlockedAnd(&bp->flags, ~CM_BUF_DIRTY);
                     _InterlockedOr(&bp->flags, CM_BUF_ERROR);
-                    bp->dirty_offset = 0;
                     bp->dirty_length = 0;
                     bp->error = code;
                     bp->dataVersion = CM_BUF_VERSION_BAD;
@@ -2522,7 +2518,6 @@ long buf_CleanDirtyBuffers(cm_scache_t *scp)
            lock_ObtainMutex(&bp->mx);
            _InterlockedAnd(&bp->cmFlags, ~CM_BUF_CMSTORING);
            _InterlockedAnd(&bp->flags, ~CM_BUF_DIRTY);
-            bp->dirty_offset = 0;
             bp->dirty_length = 0;
            _InterlockedOr(&bp->flags, CM_BUF_ERROR);
            bp->error = VNOVNODE;
index 4eb0085..cbeb035 100644 (file)
@@ -1540,7 +1540,6 @@ void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore, long code, int scp_locked)
                          */
                         _InterlockedAnd(&bufp->flags, ~CM_BUF_DIRTY);
                         _InterlockedOr(&bufp->flags, CM_BUF_ERROR);
-                        bufp->dirty_offset = 0;
                         bufp->dirty_length = 0;
                         bufp->error = code;
                         bufp->dataVersion = CM_BUF_VERSION_BAD;