From 753d3380f30f7277b88365fe1994072ae75a8be7 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Tue, 30 Apr 2013 14:37:54 -0500 Subject: [PATCH] afs: Do not invalidate all dcaches on startup Commit 20b0c65a289e2b55fb6922c8f60e873f1f4c6f97 changed afs_UFSGetDSlot to always treat a dslot entry as invalid if 'datavalid' was 0. This was to force the invalidation of the given dslot if we were reading in a dslot from the free or discard list, since the data in that dslot is not valid. However, 'datavalid' is also 0 when we read in dcache entries from disk on startup. So, this means that we invalidated all cache entries when the client started up, effectively making our persistent cache worthless. Fix this by only forcing this invalidation when we are reading from a free or discarded dcache, and not during the initial cache scan. That is, when 'indexvalid' is 1, and 'datavalid' is 0. The parameters for these Get*DSlot variants should maybe be changed to be a little more clear, but for now, this is a targeted fix for this specific issue. FIXES 131655 Reviewed-on: http://gerrit.openafs.org/9833 Tested-by: BuildBot Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Marc Dionne Reviewed-by: Derrick Brashear (cherry picked from commit 479c34614f33859131258e330e7a3f8494e0bc80) Change-Id: I72b7ad41658c51b81aa9844327372724a0f3151e Reviewed-on: http://gerrit.openafs.org/9837 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Marc Dionne Tested-by: Stephan Wiesand Reviewed-by: Stephan Wiesand --- src/afs/afs_dcache.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index cc29d6f2e..cd96464eb 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -2800,7 +2800,15 @@ afs_UFSGetDSlot(afs_int32 aslot, int indexvalid, int datavalid) (int)aslot, off); } - if (!entryok || !datavalid) { + if (indexvalid && !datavalid) { + /* we know that the given dslot does exist, but the data in it is not + * valid. this only occurs when we pull a dslot from the free or + * discard list, so be sure not to re-use the data; force invalidation. + */ + entryok = 0; + } + + if (!entryok) { tdc->f.fid.Cell = 0; tdc->f.fid.Fid.Volume = 0; tdc->f.chunk = -1; -- 2.39.5