From: Ian Kent <raven@themaw.net>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: autofs mailing list <autofs@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 4/4] autofs: add comment about autofs_mountpoint_changed()
Date: Tue, 31 Mar 2020 07:07:07 +0800 [thread overview]
Message-ID: <158560962791.14841.11556262088621555043.stgit@mickey.themaw.net> (raw)
In-Reply-To: <158560961146.14841.14430383874338917674.stgit@mickey.themaw.net>
The function autofs_mountpoint_changed() is unusual, add a comment
about two cases for which it is used.
Signed-off-by: Ian Kent <raven@themaw.net>
---
fs/autofs/root.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index b3f748e4df08..5efb7fa1ce2b 100644
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -280,9 +280,24 @@ static struct dentry *autofs_mountpoint_changed(struct path *path)
struct dentry *dentry = path->dentry;
struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
- /*
- * If this is an indirect mount the dentry could have gone away
- * as a result of an expire and a new one created.
+ /* If this is an indirect mount the dentry could have gone away
+ * and a new one created.
+ *
+ * This is unusual and I can't remember the case for which it
+ * was originally added now. But an example of how this can
+ * happen is an autofs indirect mount that has the "browse"
+ * option set and also has the "symlink" option in the autofs
+ * map entry. In this case the daemon will remove the browse
+ * directory and create a symlink as the mount (pointing to a
+ * local path) leaving the struct path stale.
+ *
+ * Another not so obvious case is when a mount in an autofs
+ * indirect mount that uses the "nobrowse" option is being
+ * expired and the mount has been umounted but the mount point
+ * directory remains when a stat family system call is made.
+ * In this case the mount point is removed (by the daemon) and
+ * a new mount triggered leading to a stale dentry in the struct
+ * path of the waiting process.
*/
if (autofs_type_indirect(sbi->type) && d_unhashed(dentry)) {
struct dentry *parent = dentry->d_parent;
next prev parent reply other threads:[~2020-03-30 23:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-30 23:06 [PATCH 1/4] autofs: dont call do_expire_wait() in autofs_d_manage() Ian Kent
2020-03-30 23:06 ` [PATCH 2/4] autofs: remove rcu_walk parameter from autofs_expire_wait() Ian Kent
2020-03-30 23:07 ` [PATCH 3/4] vfs: check for autofs expiring dentry in follow_automount() Ian Kent
2020-03-30 23:20 ` McIntyre, Vincent (CASS, Marsfield)
2020-03-31 0:22 ` Ian Kent
2020-03-30 23:07 ` Ian Kent [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-03-26 5:23 [PATCH 1/4] autofs: dont call do_expire_wait() in autofs_d_manage() Ian Kent
2020-03-26 5:23 ` [PATCH 4/4] autofs: add comment about autofs_mountpoint_changed() Ian Kent
2020-03-27 5:19 ` McIntyre, Vincent (CASS, Marsfield)
2020-03-27 11:33 ` 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=158560962791.14841.11556262088621555043.stgit@mickey.themaw.net \
--to=raven@themaw.net \
--cc=autofs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).