mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 15:00:12 +00:00
afs: Reintroduce and use DFlushDCache()
This reverts commit432ac5810e
(afs: Remove DFlushDCache()). This also re-adds the caller of DFlushDCache() removed by commit4045f3d535
(disconnected-shadow-directory-fixes-20090121), and the prototype removed by commit5ad1e6cb90
(dir: Prototype and function name cleanup). The removal of the DFlushDCache() call in commit4045f3d535
seems like a mistake. If the directory in question has dirty pages in memory, we need to flush those to the cache before making a copy of the directory's data, because we read the existing dir's data from the cache. If we don't flush, afs_MakeShadowDir() might make a copy of the dcache that is missing updates to the directory blob. Change-Id: I4f26103b3db5e1ebdbe3324d2d9f67b39ab22e09 Reviewed-on: https://gerrit.openafs.org/15740 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
This commit is contained in:
parent
407c637157
commit
799d789fba
@ -515,6 +515,31 @@ DFlushBuffer(struct buffer *ab)
|
||||
afs_CFileClose(tfile);
|
||||
}
|
||||
|
||||
void
|
||||
DFlushDCache(struct dcache *adc)
|
||||
{
|
||||
int i;
|
||||
struct buffer *tb;
|
||||
|
||||
ObtainReadLock(&afs_bufferLock);
|
||||
|
||||
for (i = 0; i <= PHPAGEMASK; i++)
|
||||
for (tb = phTable[pHash(adc->index, i)]; tb != NULL; tb = tb->hashNext)
|
||||
if (tb->fid == adc->index) {
|
||||
ObtainWriteLock(&tb->lock, 701);
|
||||
tb->lockers++;
|
||||
ReleaseReadLock(&afs_bufferLock);
|
||||
if (tb->dirty) {
|
||||
DFlushBuffer(tb);
|
||||
}
|
||||
tb->lockers--;
|
||||
ReleaseWriteLock(&tb->lock);
|
||||
ObtainReadLock(&afs_bufferLock);
|
||||
}
|
||||
|
||||
ReleaseReadLock(&afs_bufferLock);
|
||||
}
|
||||
|
||||
int
|
||||
DFlush(void)
|
||||
{
|
||||
|
@ -3879,6 +3879,9 @@ afs_MakeShadowDir(struct vcache *avc, struct dcache *adc)
|
||||
|
||||
ReleaseWriteLock(&afs_xdcache);
|
||||
|
||||
/* Make sure and flush dir buffers back into the disk cache */
|
||||
DFlushDCache(adc);
|
||||
|
||||
/* Alloc a 4k block. */
|
||||
data = afs_osi_Alloc(4096);
|
||||
if (!data) {
|
||||
|
@ -26,6 +26,7 @@ extern void afs_FreeAllAxs(struct axscache **headp);
|
||||
extern void shutdown_xscache(void);
|
||||
|
||||
/* afs_buffer.c */
|
||||
extern void DFlushDCache(struct dcache *);
|
||||
extern void shutdown_bufferpackage(void);
|
||||
|
||||
/* afs_call.c */
|
||||
|
Loading…
Reference in New Issue
Block a user