From: Ian Kent <raven@themaw.net>
To: Andrew Morton <akpm@osdl.org>
Cc: Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-fsdevel@vger.kernel.org, autofs@linux.kernel.org
Date: Wed, 18 Jan 2006 14:48:39 +0800 [thread overview]
Message-ID: <200601180648.k0I6mdHm005830@eagle.themaw.net> (raw)
This patch addresses a problem where stale dentrys stop mounts
from happening.
When a mount point directory is pre-created and a non-existent
entry within it is requested a dentry ends up being created within
the mount point directory which stops future mounts. The problem
is solved by ignoring negative, unhashed dentrys in the mount point
d_subdirs list.
Additionally the apparent cacheing of -ENOENT returns from requests
is removed. The test on d_time is a tautology and d_time is not
initialised and has an unexpected value. In short it doesn't do
what it's meant to.
The cacheing of failed requests to the daemon is important and will
be followed up later.
Signed-off-by: Ian Kent <raven@themaw.net>
--- linux-2.6.15-mm3/fs/autofs4/root.c.failed-lookup 2006-01-13 16:12:20.000000000 +0800
+++ linux-2.6.15-mm3/fs/autofs4/root.c 2006-01-13 16:13:33.000000000 +0800
@@ -294,14 +294,13 @@ static int try_to_fill_dentry(struct vfs
/* Turn this into a real negative dentry? */
if (status == -ENOENT) {
- dentry->d_time = jiffies + AUTOFS_NEGATIVE_TIMEOUT;
spin_lock(&dentry->d_lock);
dentry->d_flags &= ~DCACHE_AUTOFS_PENDING;
spin_unlock(&dentry->d_lock);
- return 1;
+ return 0;
} else if (status) {
/* Return a negative dentry, but leave it "pending" */
- return 1;
+ return 0;
}
/* Trigger mount for path component or follow link */
} else if (flags & (LOOKUP_CONTINUE | LOOKUP_DIRECTORY) ||
@@ -360,13 +359,13 @@ static int autofs4_revalidate(struct den
/* Negative dentry.. invalidate if "old" */
if (dentry->d_inode == NULL)
- return (dentry->d_time - jiffies <= AUTOFS_NEGATIVE_TIMEOUT);
+ return 0;
/* Check for a non-mountpoint directory with no contents */
spin_lock(&dcache_lock);
if (S_ISDIR(dentry->d_inode->i_mode) &&
!d_mountpoint(dentry) &&
- list_empty(&dentry->d_subdirs)) {
+ simple_empty_nolock(dentry)) {
DPRINTK("dentry=%p %.*s, emptydir",
dentry, dentry->d_name.len, dentry->d_name.name);
spin_unlock(&dcache_lock);
--- linux-2.6.15-mm3/fs/autofs4/autofs_i.h.failed-lookup 2006-01-13 16:05:10.000000000 +0800
+++ linux-2.6.15-mm3/fs/autofs4/autofs_i.h 2006-01-13 16:13:33.000000000 +0800
@@ -40,14 +40,6 @@
#define AUTOFS_SUPER_MAGIC 0x0187
-/*
- * If the daemon returns a negative response (AUTOFS_IOC_FAIL) then the
- * kernel will keep the negative response cached for up to the time given
- * here, although the time can be shorter if the kernel throws the dcache
- * entry away. This probably should be settable from user space.
- */
-#define AUTOFS_NEGATIVE_TIMEOUT (60*HZ) /* 1 minute */
-
/* Unified info structure. This is pointed to by both the dentry and
inode structures. Each file in the filesystem has an instance of this
structure. It holds a reference to the dentry, so dentries are never
WARNING: multiple messages have this Message-ID (diff)
From: Ian Kent <raven@themaw.net>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-fsdevel@vger.kernel.org, autofs@linux.kernel.org,
Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: (no subject)
Date: Wed, 18 Jan 2006 14:48:39 +0800 [thread overview]
Message-ID: <200601180648.k0I6mdHm005830@eagle.themaw.net> (raw)
This patch addresses a problem where stale dentrys stop mounts
from happening.
When a mount point directory is pre-created and a non-existent
entry within it is requested a dentry ends up being created within
the mount point directory which stops future mounts. The problem
is solved by ignoring negative, unhashed dentrys in the mount point
d_subdirs list.
Additionally the apparent cacheing of -ENOENT returns from requests
is removed. The test on d_time is a tautology and d_time is not
initialised and has an unexpected value. In short it doesn't do
what it's meant to.
The cacheing of failed requests to the daemon is important and will
be followed up later.
Signed-off-by: Ian Kent <raven@themaw.net>
--- linux-2.6.15-mm3/fs/autofs4/root.c.failed-lookup 2006-01-13 16:12:20.000000000 +0800
+++ linux-2.6.15-mm3/fs/autofs4/root.c 2006-01-13 16:13:33.000000000 +0800
@@ -294,14 +294,13 @@ static int try_to_fill_dentry(struct vfs
/* Turn this into a real negative dentry? */
if (status == -ENOENT) {
- dentry->d_time = jiffies + AUTOFS_NEGATIVE_TIMEOUT;
spin_lock(&dentry->d_lock);
dentry->d_flags &= ~DCACHE_AUTOFS_PENDING;
spin_unlock(&dentry->d_lock);
- return 1;
+ return 0;
} else if (status) {
/* Return a negative dentry, but leave it "pending" */
- return 1;
+ return 0;
}
/* Trigger mount for path component or follow link */
} else if (flags & (LOOKUP_CONTINUE | LOOKUP_DIRECTORY) ||
@@ -360,13 +359,13 @@ static int autofs4_revalidate(struct den
/* Negative dentry.. invalidate if "old" */
if (dentry->d_inode == NULL)
- return (dentry->d_time - jiffies <= AUTOFS_NEGATIVE_TIMEOUT);
+ return 0;
/* Check for a non-mountpoint directory with no contents */
spin_lock(&dcache_lock);
if (S_ISDIR(dentry->d_inode->i_mode) &&
!d_mountpoint(dentry) &&
- list_empty(&dentry->d_subdirs)) {
+ simple_empty_nolock(dentry)) {
DPRINTK("dentry=%p %.*s, emptydir",
dentry, dentry->d_name.len, dentry->d_name.name);
spin_unlock(&dcache_lock);
--- linux-2.6.15-mm3/fs/autofs4/autofs_i.h.failed-lookup 2006-01-13 16:05:10.000000000 +0800
+++ linux-2.6.15-mm3/fs/autofs4/autofs_i.h 2006-01-13 16:13:33.000000000 +0800
@@ -40,14 +40,6 @@
#define AUTOFS_SUPER_MAGIC 0x0187
-/*
- * If the daemon returns a negative response (AUTOFS_IOC_FAIL) then the
- * kernel will keep the negative response cached for up to the time given
- * here, although the time can be shorter if the kernel throws the dcache
- * entry away. This probably should be settable from user space.
- */
-#define AUTOFS_NEGATIVE_TIMEOUT (60*HZ) /* 1 minute */
-
/* Unified info structure. This is pointed to by both the dentry and
inode structures. Each file in the filesystem has an instance of this
structure. It holds a reference to the dentry, so dentries are never
next reply other threads:[~2006-01-18 6:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-18 6:48 Ian Kent [this message]
2006-01-18 6:48 ` (no subject) Ian Kent
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200601180648.k0I6mdHm005830@eagle.themaw.net \
--to=raven@themaw.net \
--cc=akpm@osdl.org \
--cc=autofs@linux.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.