From d23b655e7857a008b36147260972d76f4c5b1795 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. Reviewed-on: http://gerrit.openafs.org/8452 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman (cherry picked from commit f56c01d313140b625b4342feddfe464342d1ced4) Change-Id: I888e56c8c34bcae58c51ba965fd59e5539e1bab5 Reviewed-on: http://gerrit.openafs.org/8647 Tested-by: BuildBot Reviewed-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 c892b7783..3c07f20bc 100644 --- a/src/WINNT/afsd/cm_buf.c +++ b/src/WINNT/afsd/cm_buf.c @@ -780,7 +780,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){ _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; @@ -1562,7 +1561,6 @@ long buf_Truncate(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp, if (LargeIntegerLessThanOrEqualTo(*sizep, bufp->offset)) { /* truncating the entire page */ _InterlockedAnd(&bufp->flags, ~CM_BUF_DIRTY); - bufp->dirty_offset = 0; bufp->dirty_length = 0; bufp->dataVersion = CM_BUF_VERSION_BAD; /* known bad */ bufp->dirtyCounter++; @@ -1655,7 +1653,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++; @@ -1785,7 +1782,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; @@ -1991,7 +1987,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 00f841e58..031ce29f1 100644 --- a/src/WINNT/afsd/cm_dcache.c +++ b/src/WINNT/afsd/cm_dcache.c @@ -1471,7 +1471,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; -- 2.39.5