From: Andrew Deason Date: Tue, 30 Apr 2013 19:37:54 +0000 (-0500) Subject: afs: Do not invalidate all dcaches on startup X-Git-Tag: openafs-stable-1_8_0pre1~1197 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=479c34614f33859131258e330e7a3f8494e0bc80;hp=a7165067d79814bacabd55e9bab66c6a3ae45b76 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 Change-Id: Ic23f1e17cd966b8468849f54fc6fda37e1f61c0c Reviewed-on: http://gerrit.openafs.org/9833 Tested-by: BuildBot Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Marc Dionne Reviewed-by: Derrick Brashear --- diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index 8833c39..2eaa50d 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -2899,7 +2899,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;