[9266] in Athena Bugs
fs flushvol (cont'd)
daemon@ATHENA.MIT.EDU (Richard Basch)
Sun May 3 13:46:09 1992
Date: Sun, 3 May 92 13:45:53 -0400
To: bugs@MIT.EDU, bug-afs@Athena.MIT.EDU
From: "Richard Basch" <basch@MIT.EDU>
The dcache is not being maintained properly, but the following works
around the problem of improper usage of the IFEverUsed flag. According
to the rest of the code, this should always be safe (and from looking at
lots of cache structures in memory, I am confident with this code).
This code also does not suffer from possibly re-ordering the LRU cache
of untouched entries.
*** /tmp/,RCSt1a22520 Sun May 3 13:41:33 1992
--- afs_pioctl.c Sun May 3 07:47:46 1992
***************
*** 1430,1443 ****
cell = avc->fid.Cell;
ObtainWriteLock(&afs_xdcache); /* needed if you're going to flush any stuff */
for(i=0;i<afs_cacheFiles;i++) {
! if (!(afs_indexFlags[i] & IFEverUsed)) continue; /* never had any data */
! tdc = afs_GetDSlot(i, (struct dcache *) 0);
! if (tdc->refCount <= 1) { /* too high, in use by running sys call */
! if (tdc->f.fid.Fid.Volume == volume && tdc->f.fid.Cell == cell) {
! afs_FlushDCache(tdc);
! }
! }
! tdc->refCount--; /* bumped by getdslot */
}
ReleaseWriteLock(&afs_xdcache);
return 0;
--- 1430,1438 ----
cell = avc->fid.Cell;
ObtainWriteLock(&afs_xdcache); /* needed if you're going to flush any stuff */
for(i=0;i<afs_cacheFiles;i++) {
! if ((tdc = afs_indexTable[i]) == (struct dcache *)0) continue;
! if (tdc->f.fid.Fid.Volume == volume && tdc->f.fid.Cell == cell && tdc->refCount == 0)
! afs_FlushDCache(tdc);
}
ReleaseWriteLock(&afs_xdcache);
return 0;
However, we seem to have files in /usr/vice/cache with non-zero sizes
without corresponding dcache entries in the table in memory, so there
are still other bugs to be tracked down. It seems to occur once the
cache threshold has been reached. One problem is that
afs_GetDownDSlot() does not truncate the files, but this only accounts
for at most 5 disk-cache entries (once they end up on the free pool,
they will be used first, and the function seems to always be called with
the argument 5).
-R