From 53b3988d474435254a3b053a68bb24ce9e439295 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Thu, 15 Jun 2000 01:55:58 +0000 Subject: Merge with 2.3.99-pre9. --- fs/coda/cache.c | 44 ++++++++------------------------------------ fs/coda/dir.c | 10 +++++----- fs/coda/psdev.c | 2 ++ 3 files changed, 15 insertions(+), 41 deletions(-) (limited to 'fs/coda') diff --git a/fs/coda/cache.c b/fs/coda/cache.c index fa8a66e0c..68be7a69d 100644 --- a/fs/coda/cache.c +++ b/fs/coda/cache.c @@ -259,8 +259,6 @@ int coda_cache_check(struct inode *inode, int mask) void coda_purge_dentries(struct inode *inode) { - struct list_head *tmp, *head = &inode->i_dentry; - if (!inode) return ; @@ -268,23 +266,7 @@ void coda_purge_dentries(struct inode *inode) iget(inode->i_sb, inode->i_ino); /* catch the dentries later if some are still busy */ coda_flag_inode(inode, C_PURGE); - -restart: - tmp = head; - while ((tmp = tmp->next) != head) { - struct dentry *dentry = list_entry(tmp, struct dentry, d_alias); - if (!dentry->d_count) { - CDEBUG(D_DOWNCALL, - "coda_free_dentries: freeing %s/%s, i_count=%d\n", - dentry->d_parent->d_name.name, dentry->d_name.name, - inode->i_count); - dget(dentry); - d_drop(dentry); - dput(dentry); - goto restart; - } - - } + d_prune_aliases(inode); iput(inode); } @@ -311,28 +293,18 @@ static void coda_flag_children(struct dentry *parent, int flag) void coda_flag_inode_children(struct inode *inode, int flag) { - struct list_head *alias; struct dentry *alias_de; ENTRY; - if ( !inode ) + if ( !inode || !S_ISDIR(inode->i_mode)) return; - if (list_empty(&inode->i_dentry)) - return; - - /* I believe that shrink_dcache_parent will not - remove dentries from the alias list. If it - does we are toast. - */ - alias = inode->i_dentry.next; - while ( alias != &inode->i_dentry ) { - alias_de = list_entry(alias, struct dentry, d_alias); - coda_flag_children(alias_de, flag); - alias = alias->next; - shrink_dcache_parent(alias_de); - } - + alias_de = d_find_alias(inode); + if (!alias_de) + return; + coda_flag_children(alias_de, flag); + shrink_dcache_parent(alias_de); + dput(alias_de); } /* this will not zap the inode away */ diff --git a/fs/coda/dir.c b/fs/coda/dir.c index bb51b0c05..83f7bbcc5 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c @@ -45,7 +45,7 @@ static int coda_readdir(struct file *file, void *dirent, filldir_t filldir); /* dentry ops */ static int coda_dentry_revalidate(struct dentry *de, int); -static void coda_dentry_delete(struct dentry *); +static int coda_dentry_delete(struct dentry *); /* support routines */ static int coda_venus_readdir(struct file *filp, void *dirent, @@ -434,7 +434,6 @@ int coda_unlink(struct inode *dir, struct dentry *de) /* cache management: mtime has changed, ask Venus */ dircnp->c_flags |= C_VATTR; de->d_inode->i_nlink--; - d_delete(de); return 0; } @@ -801,20 +800,21 @@ static int coda_dentry_revalidate(struct dentry *de, int flags) * This is the callback from dput() when d_count is going to 0. * We use this to unhash dentries with bad inodes. */ -static void coda_dentry_delete(struct dentry * dentry) +static int coda_dentry_delete(struct dentry * dentry) { int flags; if (!dentry->d_inode) - return ; + return 0; flags = (ITOC(dentry->d_inode)->c_flags) & C_PURGE; if (is_bad_inode(dentry->d_inode) || flags) { CDEBUG(D_DOWNCALL, "bad inode, unhashing %s/%s, %ld\n", dentry->d_parent->d_name.name, dentry->d_name.name, dentry->d_inode->i_ino); - d_drop(dentry); + return 1; } + return 0; } diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index 1a7fb195c..b88c602c6 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c @@ -296,6 +296,8 @@ static int coda_psdev_release(struct inode * inode, struct file * file) vcp->vc_inuse, vcp->vc_pid, current->pid); if ( vcp->vc_pid != current->pid ) { + /* FIXME: this is broken. If venus does fork(), accounting goes wrong */ + printk( "Closed by someone else than caller?\n" ); return 0; } -- cgit v1.2.3