From 646028dbdb90640f14f7a22aede858432ffa9025 Mon Sep 17 00:00:00 2001 From: Chaskiel M Grundman Date: Sun, 16 Jan 2005 16:43:34 +0000 Subject: [PATCH] linux26-dcache-lock-20050116 FIXES 17266 "The changes I submitted previously, and committed as linux-26-vlru-cycle-20041012 do not satisfy necessary invariants of the dcache api. 1) the dcache_lock is not held when calling d_unhashed and list_empty(&dentry->d_subdirs) 2) the caller of d_prune_aliases does not hold it's own ref on the inode Patch attached.(has been used lightly for a month or so)" --- src/afs/afs_vcache.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 9d4ff990b9..6e38da845d 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -842,16 +842,24 @@ afs_NewVCache(struct VenusFid *afid, struct server *serverp) #if defined(AFS_LINUX26_ENV) struct dentry *dentry; struct list_head *cur, *head = &(AFSTOI(tvc))->i_dentry; + AFS_FAST_HOLD(tvc); AFS_GUNLOCK(); +shrink_restart: + DLOCK(); cur=head; while ((cur = cur->next) != head) { dentry = list_entry(cur, struct dentry, d_alias); if (!d_unhashed(dentry) && - !list_empty(&dentry->d_subdirs)) + !list_empty(&dentry->d_subdirs)) { + DUNLOCK(); shrink_dcache_parent(dentry); + goto shrink_restart; + } } + DUNLOCK(); d_prune_aliases(AFSTOI(tvc)); AFS_GLOCK(); + AFS_FAST_RELE(tvc); #else afs_TryFlushDcacheChildren(tvc); #endif