--- dcache.c.orig Wed Jun 16 00:22:03 2004 +++ dcache.c Wed Jun 16 01:00:47 2004 @@ -51,6 +51,7 @@ static unsigned int d_hash_shift; static struct list_head *dentry_hashtable; static LIST_HEAD(dentry_unused); +struct semaphore dcache_lru_sem; /* Statistics gathering. */ struct dentry_stat_t dentry_stat = {0, 0, 45, 0,}; @@ -381,6 +382,7 @@ struct list_head *tmp, *next; struct dentry *dentry; + down(&dcache_lru_sem); /* * Pass one ... move the dentries for the specified * superblock to the most recent end of the unused list. @@ -416,6 +418,7 @@ goto repeat; } spin_unlock(&dcache_lock); + up(&dcache_lru_sem); } /* @@ -548,8 +551,10 @@ { int found; + down(&dcache_lru_sem); while ((found = select_parent(parent)) != 0) prune_dcache(found); + up(&dcache_lru_sem); } /* @@ -581,9 +586,11 @@ if (!(gfp_mask & __GFP_FS)) return 0; + down(&dcache_lru_sem); count = dentry_stat.nr_unused / priority; prune_dcache(count); + up(&dcache_lru_sem); return kmem_cache_shrink(dentry_cache); } @@ -1247,6 +1254,7 @@ d++; i--; } while (i); + sema_init(&dcache_lru_sem, 1); } static void init_buffer_head(void * foo, kmem_cache_t * cachep, unsigned long flags)