Commit 9a3b5dd5 authored by Ian Kent's avatar Ian Kent Committed by james toy

We unhash the dentry (in a subsequent patch) in ->d_revalidate() in order

to send mount requests to ->lookup().  But then we can not rely on
d_unhased() to give reliable results because it may be called at any time
by any code path.  The d_unhashed() function is used by __simple_empty()
in the path walking callbacks but autofs mount point dentrys should have
no directories at all so a list_empty() on d_subdirs should be (and is)
sufficient.
Signed-off-by: default avatarIan Kent <raven@themaw.net>
Cc: Sage Weil <sage@newdream.net>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Andreas Dilger <adilger@sun.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Yehuda Saheh <yehuda@newdream.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 4a62b15e
...@@ -133,7 +133,7 @@ static int autofs4_dir_open(struct inode *inode, struct file *file) ...@@ -133,7 +133,7 @@ static int autofs4_dir_open(struct inode *inode, struct file *file)
* it. * it.
*/ */
spin_lock(&dcache_lock); spin_lock(&dcache_lock);
if (!d_mountpoint(dentry) && __simple_empty(dentry)) { if (!d_mountpoint(dentry) && list_empty(&dentry->d_subdirs)) {
spin_unlock(&dcache_lock); spin_unlock(&dcache_lock);
return -ENOENT; return -ENOENT;
} }
...@@ -257,7 +257,7 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd) ...@@ -257,7 +257,7 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
* mount it again. * mount it again.
*/ */
if (ino->flags & AUTOFS_INF_PENDING || if (ino->flags & AUTOFS_INF_PENDING ||
(!d_mountpoint(dentry) && __simple_empty(dentry))) { (!d_mountpoint(dentry) && list_empty(&dentry->d_subdirs))) {
spin_unlock(&dcache_lock); spin_unlock(&dcache_lock);
spin_unlock(&sbi->fs_lock); spin_unlock(&sbi->fs_lock);
...@@ -340,8 +340,7 @@ static int autofs4_revalidate(struct dentry *dentry, struct nameidata *nd) ...@@ -340,8 +340,7 @@ static int autofs4_revalidate(struct dentry *dentry, struct nameidata *nd)
/* Check for a non-mountpoint directory with no contents */ /* Check for a non-mountpoint directory with no contents */
spin_lock(&dcache_lock); spin_lock(&dcache_lock);
if (S_ISDIR(dentry->d_inode->i_mode) && if (S_ISDIR(dentry->d_inode->i_mode) &&
!d_mountpoint(dentry) && !d_mountpoint(dentry) && list_empty(&dentry->d_subdirs)) {
__simple_empty(dentry)) {
DPRINTK("dentry=%p %.*s, emptydir", DPRINTK("dentry=%p %.*s, emptydir",
dentry, dentry->d_name.len, dentry->d_name.name); dentry, dentry->d_name.len, dentry->d_name.name);
spin_unlock(&dcache_lock); spin_unlock(&dcache_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment