From: Christof Hanke Date: Wed, 15 Sep 2004 04:54:28 +0000 (+0000) Subject: segments-keep-chunkbytes-and-validpos-in-sync-20040914 X-Git-Tag: BP-disconnected~248 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=1ea05bb5679ba0e00b02ef2b20f72f7b2c39eb14;p=packages%2Fo%2Fopenafs.git segments-keep-chunkbytes-and-validpos-in-sync-20040914 FIXES 15200 "Basically, the pointers (struct dcache *)->validPos and (struct dcache *)->f.chunkBytes are not kept in sync." --- diff --git a/src/afs/afs_segments.c b/src/afs/afs_segments.c index f9d5b8068..1ebbcebc6 100644 --- a/src/afs/afs_segments.c +++ b/src/afs/afs_segments.c @@ -1041,6 +1041,12 @@ afs_TruncateAllSegments(register struct vcache *avc, afs_size_t alen, afs_CFileTruncate(tfile, newSize); afs_CFileClose(tfile); afs_AdjustSize(tdc, newSize); + if (alen < tdc->validPos) { + if (alen < AFS_CHUNKTOBASE(tdc->f.chunk)) + tdc->validPos = 0; + else + tdc->validPos = alen; + } ConvertWToSLock(&tdc->lock); } ReleaseSharedLock(&tdc->lock);