From f56c01d313140b625b4342feddfe464342d1ced4 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 13 Nov 2012 17:59:06 -0500 Subject: [PATCH] Windows: Do not reset cm_buf.offset on error 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 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/cm_buf.c | 5 ----- src/WINNT/afsd/cm_dcache.c | 1 - 2 files changed, 6 deletions(-) diff --git a/src/WINNT/afsd/cm_buf.c b/src/WINNT/afsd/cm_buf.c index 58a7891..96b5a70 100644 --- a/src/WINNT/afsd/cm_buf.c +++ b/src/WINNT/afsd/cm_buf.c @@ -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; diff --git a/src/WINNT/afsd/cm_dcache.c b/src/WINNT/afsd/cm_dcache.c index 4eb0085..cbeb035 100644 --- a/src/WINNT/afsd/cm_dcache.c +++ b/src/WINNT/afsd/cm_dcache.c @@ -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; -- 1.9.4