From f753c4a45ad7d66760ca5162614f396b5041d02f Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 4 Oct 2006 02:16:16 -0700 Subject: [PATCH] --- yaml --- r: 38401 b: refs/heads/master c: 21c0d8fdd95024ffa708a938099148b8f1078d46 h: refs/heads/master i: 38399: b5908293028896088806b8cbeeba23c4969d9ece v: v3 --- [refs] | 2 +- trunk/fs/dcache.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 94fd453d401e..00a4ca05c475 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 44c556000a31e8079cfbb9a42a7edb93ca6b589a +refs/heads/master: 21c0d8fdd95024ffa708a938099148b8f1078d46 diff --git a/trunk/fs/dcache.c b/trunk/fs/dcache.c index fc2faa44f8d1..2355bddad8de 100644 --- a/trunk/fs/dcache.c +++ b/trunk/fs/dcache.c @@ -291,9 +291,9 @@ struct dentry * dget_locked(struct dentry *dentry) * it can be unhashed only if it has no children, or if it is the root * of a filesystem. * - * If the inode has a DCACHE_DISCONNECTED alias, then prefer + * If the inode has an IS_ROOT, DCACHE_DISCONNECTED alias, then prefer * any other hashed alias over that one unless @want_discon is set, - * in which case only return a DCACHE_DISCONNECTED alias. + * in which case only return an IS_ROOT, DCACHE_DISCONNECTED alias. */ static struct dentry * __d_find_alias(struct inode *inode, int want_discon) @@ -309,7 +309,8 @@ static struct dentry * __d_find_alias(struct inode *inode, int want_discon) prefetch(next); alias = list_entry(tmp, struct dentry, d_alias); if (S_ISDIR(inode->i_mode) || !d_unhashed(alias)) { - if (alias->d_flags & DCACHE_DISCONNECTED) + if (IS_ROOT(alias) && + (alias->d_flags & DCACHE_DISCONNECTED)) discon_alias = alias; else if (!want_discon) { __dget_locked(alias); @@ -1004,7 +1005,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) { struct dentry *new = NULL; - if (inode) { + if (inode && S_ISDIR(inode->i_mode)) { spin_lock(&dcache_lock); new = __d_find_alias(inode, 1); if (new) {