From patchwork Thu Mar 26 05:23:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Kent X-Patchwork-Id: 11459279 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18D701668 for ; Thu, 26 Mar 2020 05:32:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EC0372082D for ; Thu, 26 Mar 2020 05:32:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726330AbgCZFco (ORCPT ); Thu, 26 Mar 2020 01:32:44 -0400 Received: from icp-osb-irony-out5.external.iinet.net.au ([203.59.1.221]:30150 "EHLO icp-osb-irony-out5.external.iinet.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726279AbgCZFcn (ORCPT ); Thu, 26 Mar 2020 01:32:43 -0400 X-SMTP-MATCH: 0 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2CEBwBuO3xe/4G50HZmHQEBAQkBEQUFAYFqBQELAQGCJ4FhEiqEGo9gBoESOIlnkU0KAQEBAQEBAQEBGxkBAgQBAYREgiokNwYOAhABAQEFAQEBAQEFAwFthQpYQgEMAYU9BFIoDQIYDgJJFhOFfiSuIH8zGgKKToEOKgGMLhp5gQeBRAOBNoFmgReGRYJeBJBzhw1FmBCCRpcJHY87A4whLaxpI4FYTS4KgydQGJx/NzCBBgEBhBmKBAEB X-IPAS-Result: A2CEBwBuO3xe/4G50HZmHQEBAQkBEQUFAYFqBQELAQGCJ4FhEiqEGo9gBoESOIlnkU0KAQEBAQEBAQEBGxkBAgQBAYREgiokNwYOAhABAQEFAQEBAQEFAwFthQpYQgEMAYU9BFIoDQIYDgJJFhOFfiSuIH8zGgKKToEOKgGMLhp5gQeBRAOBNoFmgReGRYJeBJBzhw1FmBCCRpcJHY87A4whLaxpI4FYTS4KgydQGJx/NzCBBgEBhBmKBAEB X-IronPort-AV: E=Sophos;i="5.72,307,1580745600"; d="scan'208";a="304456524" Received: from unknown (HELO mickey.themaw.net) ([118.208.185.129]) by icp-osb-irony-out5.iinet.net.au with ESMTP; 26 Mar 2020 13:23:18 +0800 Subject: [PATCH 1/4] autofs: dont call do_expire_wait() in autofs_d_manage() From: Ian Kent To: Al Viro Cc: autofs mailing list , linux-fsdevel , Kernel Mailing List Date: Thu, 26 Mar 2020 13:23:18 +0800 Message-ID: <158520019862.5325.7856909810909592388.stgit@mickey.themaw.net> User-Agent: StGit/unknown-version MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Calling do_expire_wait() in autofs_d_manage() isn't really necessary. If in rcu-walk mode -ECHILD will be returned and if in ref-walk mode and the dentry might be picked for expire (or is expiring) 0 will be returned otherwise it waits for the expire. But waiting is meant to be done in autofs_d_automount() so simplify autofs_d_manage() by testing the expire status and returning only what's needed. Signed-off-by: Ian Kent --- fs/autofs/root.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/autofs/root.c b/fs/autofs/root.c index 5aaa1732bf1e..a3b7c72a298d 100644 --- a/fs/autofs/root.c +++ b/fs/autofs/root.c @@ -410,9 +410,12 @@ static int autofs_d_manage(const struct path *path, bool rcu_walk) return 0; } - /* Wait for pending expires */ - if (do_expire_wait(path, rcu_walk) == -ECHILD) - return -ECHILD; + /* Check for (possible) pending expire */ + if (ino->flags & AUTOFS_INF_WANT_EXPIRE) { + if (rcu_walk) + return -ECHILD; + return 0; + } /* * This dentry may be under construction so wait on mount @@ -432,8 +435,6 @@ static int autofs_d_manage(const struct path *path, bool rcu_walk) */ struct inode *inode; - if (ino->flags & AUTOFS_INF_WANT_EXPIRE) - return 0; if (path_is_mountpoint(path)) return 0; inode = d_inode_rcu(dentry); From patchwork Thu Mar 26 05:23:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Kent X-Patchwork-Id: 11459277 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C4F55913 for ; Thu, 26 Mar 2020 05:32:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A5584206E6 for ; Thu, 26 Mar 2020 05:32:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726260AbgCZFcl (ORCPT ); Thu, 26 Mar 2020 01:32:41 -0400 Received: from icp-osb-irony-out5.external.iinet.net.au ([203.59.1.221]:30137 "EHLO icp-osb-irony-out5.external.iinet.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725775AbgCZFcl (ORCPT ); Thu, 26 Mar 2020 01:32:41 -0400 X-Greylist: delayed 556 seconds by postgrey-1.27 at vger.kernel.org; Thu, 26 Mar 2020 01:32:37 EDT X-SMTP-MATCH: 0 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2DKFABuO3xe/4G50HZmHAEBAQEBBwEBEQEEBAEBgXsCgieBYRIqhBqPYAaBEjiJZ4ophT2BZwoBAQEBAQEBAQEbGQECBAEBhEQCgigkOBMCEAEBAQUBAQEBAQUDAW2FClhCAQwBhRQGIwRSEBgNAhgOAgJHEAYThX4kriB/MxoCik6BDioBjC4aeYEHgREzA4E2gWaEMYMrgl4EjXAMgneHDUWBAJcQgkaXCR2POwOMIS2saiKBWE0uCoMnUBiONheOMjcwgQYBAYQZiSVfAQE X-IPAS-Result: A2DKFABuO3xe/4G50HZmHAEBAQEBBwEBEQEEBAEBgXsCgieBYRIqhBqPYAaBEjiJZ4ophT2BZwoBAQEBAQEBAQEbGQECBAEBhEQCgigkOBMCEAEBAQUBAQEBAQUDAW2FClhCAQwBhRQGIwRSEBgNAhgOAgJHEAYThX4kriB/MxoCik6BDioBjC4aeYEHgREzA4E2gWaEMYMrgl4EjXAMgneHDUWBAJcQgkaXCR2POwOMIS2saiKBWE0uCoMnUBiONheOMjcwgQYBAYQZiSVfAQE X-IronPort-AV: E=Sophos;i="5.72,307,1580745600"; d="scan'208";a="304456540" Received: from unknown (HELO mickey.themaw.net) ([118.208.185.129]) by icp-osb-irony-out5.iinet.net.au with ESMTP; 26 Mar 2020 13:23:24 +0800 Subject: [PATCH 2/4] autofs: remove rcu_walk parameter from autofs_expire_wait() From: Ian Kent To: Al Viro Cc: autofs mailing list , linux-fsdevel , Kernel Mailing List Date: Thu, 26 Mar 2020 13:23:23 +0800 Message-ID: <158520020391.5325.4702796205483079373.stgit@mickey.themaw.net> In-Reply-To: <158520019862.5325.7856909810909592388.stgit@mickey.themaw.net> References: <158520019862.5325.7856909810909592388.stgit@mickey.themaw.net> User-Agent: StGit/unknown-version MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Now that do_expire_wait() isn't called from autofs_d_manage() the rcu_walk boolean parameter can be removed. Now autofs_expire_wait() and autofs_lookup_expiring() are no longer called from rcu-walk context either so remove the extra parameter from them too. Signed-off-by: Ian Kent --- fs/autofs/autofs_i.h | 2 +- fs/autofs/dev-ioctl.c | 2 +- fs/autofs/expire.c | 5 +---- fs/autofs/root.c | 18 ++++++------------ 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h index 054f97b07754..5fc0c31b1fd5 100644 --- a/fs/autofs/autofs_i.h +++ b/fs/autofs/autofs_i.h @@ -152,7 +152,7 @@ void autofs_free_ino(struct autofs_info *); /* Expiration */ int is_autofs_dentry(struct dentry *); -int autofs_expire_wait(const struct path *path, int rcu_walk); +int autofs_expire_wait(const struct path *path); int autofs_expire_run(struct super_block *, struct vfsmount *, struct autofs_sb_info *, struct autofs_packet_expire __user *); diff --git a/fs/autofs/dev-ioctl.c b/fs/autofs/dev-ioctl.c index a3cdb0036c5d..a892a517c695 100644 --- a/fs/autofs/dev-ioctl.c +++ b/fs/autofs/dev-ioctl.c @@ -437,7 +437,7 @@ static int autofs_dev_ioctl_requester(struct file *fp, ino = autofs_dentry_ino(path.dentry); if (ino) { err = 0; - autofs_expire_wait(&path, 0); + autofs_expire_wait(&path); spin_lock(&sbi->fs_lock); param->requester.uid = from_kuid_munged(current_user_ns(), ino->uid); diff --git a/fs/autofs/expire.c b/fs/autofs/expire.c index a1c7701007e7..f67da46f6992 100644 --- a/fs/autofs/expire.c +++ b/fs/autofs/expire.c @@ -486,7 +486,7 @@ static struct dentry *autofs_expire_indirect(struct super_block *sb, return expired; } -int autofs_expire_wait(const struct path *path, int rcu_walk) +int autofs_expire_wait(const struct path *path) { struct dentry *dentry = path->dentry; struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb); @@ -497,9 +497,6 @@ int autofs_expire_wait(const struct path *path, int rcu_walk) /* Block on any pending expire */ if (!(ino->flags & AUTOFS_INF_WANT_EXPIRE)) return 0; - if (rcu_walk) - return -ECHILD; - retry: spin_lock(&sbi->fs_lock); state = ino->flags & (AUTOFS_INF_WANT_EXPIRE | AUTOFS_INF_EXPIRING); diff --git a/fs/autofs/root.c b/fs/autofs/root.c index a3b7c72a298d..a1c9c32e104f 100644 --- a/fs/autofs/root.c +++ b/fs/autofs/root.c @@ -177,8 +177,7 @@ static struct dentry *autofs_lookup_active(struct dentry *dentry) return NULL; } -static struct dentry *autofs_lookup_expiring(struct dentry *dentry, - bool rcu_walk) +static struct dentry *autofs_lookup_expiring(struct dentry *dentry) { struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb); struct dentry *parent = dentry->d_parent; @@ -197,11 +196,6 @@ static struct dentry *autofs_lookup_expiring(struct dentry *dentry, struct dentry *expiring; const struct qstr *qstr; - if (rcu_walk) { - spin_unlock(&sbi->lookup_lock); - return ERR_PTR(-ECHILD); - } - ino = list_entry(p, struct autofs_info, expiring); expiring = ino->dentry; @@ -257,16 +251,16 @@ static int autofs_mount_wait(const struct path *path, bool rcu_walk) return status; } -static int do_expire_wait(const struct path *path, bool rcu_walk) +static int do_expire_wait(const struct path *path) { struct dentry *dentry = path->dentry; struct dentry *expiring; - expiring = autofs_lookup_expiring(dentry, rcu_walk); + expiring = autofs_lookup_expiring(dentry); if (IS_ERR(expiring)) return PTR_ERR(expiring); if (!expiring) - return autofs_expire_wait(path, rcu_walk); + return autofs_expire_wait(path); else { const struct path this = { .mnt = path->mnt, .dentry = expiring }; /* @@ -274,7 +268,7 @@ static int do_expire_wait(const struct path *path, bool rcu_walk) * be quite complete, but the directory has been removed * so it must have been successful, just wait for it. */ - autofs_expire_wait(&this, 0); + autofs_expire_wait(&this); autofs_del_expiring(expiring); dput(expiring); } @@ -327,7 +321,7 @@ static struct vfsmount *autofs_d_automount(struct path *path) * and the directory was removed, so just go ahead and try * the mount. */ - status = do_expire_wait(path, 0); + status = do_expire_wait(path); if (status && status != -EAGAIN) return NULL; From patchwork Thu Mar 26 05:23:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Kent X-Patchwork-Id: 11459283 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D9AA913 for ; Thu, 26 Mar 2020 05:32:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5710B207FC for ; Thu, 26 Mar 2020 05:32:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727652AbgCZFcz (ORCPT ); Thu, 26 Mar 2020 01:32:55 -0400 Received: from icp-osb-irony-out5.external.iinet.net.au ([203.59.1.221]:30174 "EHLO icp-osb-irony-out5.external.iinet.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727600AbgCZFcy (ORCPT ); Thu, 26 Mar 2020 01:32:54 -0400 X-SMTP-MATCH: 0 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2A8BQBuO3xe/4G50HZmHAEBAQEBBwEBEQEEBAEBgWoEAQELAQGBdjGBYRIqhBqPZoESOIlniimHJAoBAQEBAQEBAQEbGQECBAEBhEQCgigkNwYOAhABAQEFAQEBAQEFAwFthQpYQgEMAYUUBiMEUhAYDQIYDgICRxAGE4V+JK4gfzMaAopOgQ4qAYwuGnmBB4FEA4E2c3OBBAGGV4JeBI1wgwOHDUWBAJcQgkaNMolXHY87A4whLaZbhg4jgVhNLgqDJ1AYjkKOPTcwgQYBAYQZiSVfAQE X-IPAS-Result: A2A8BQBuO3xe/4G50HZmHAEBAQEBBwEBEQEEBAEBgWoEAQELAQGBdjGBYRIqhBqPZoESOIlniimHJAoBAQEBAQEBAQEbGQECBAEBhEQCgigkNwYOAhABAQEFAQEBAQEFAwFthQpYQgEMAYUUBiMEUhAYDQIYDgICRxAGE4V+JK4gfzMaAopOgQ4qAYwuGnmBB4FEA4E2c3OBBAGGV4JeBI1wgwOHDUWBAJcQgkaNMolXHY87A4whLaZbhg4jgVhNLgqDJ1AYjkKOPTcwgQYBAYQZiSVfAQE X-IronPort-AV: E=Sophos;i="5.72,307,1580745600"; d="scan'208";a="304456561" Received: from unknown (HELO mickey.themaw.net) ([118.208.185.129]) by icp-osb-irony-out5.iinet.net.au with ESMTP; 26 Mar 2020 13:23:30 +0800 Subject: [PATCH 3/4] vfs: check for autofs expiring dentry in follow_automount() From: Ian Kent To: Al Viro Cc: autofs mailing list , linux-fsdevel , Kernel Mailing List Date: Thu, 26 Mar 2020 13:23:29 +0800 Message-ID: <158520020932.5325.1998880625163566595.stgit@mickey.themaw.net> In-Reply-To: <158520019862.5325.7856909810909592388.stgit@mickey.themaw.net> References: <158520019862.5325.7856909810909592388.stgit@mickey.themaw.net> User-Agent: StGit/unknown-version MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org follow_automount() checks if a stat family system call path walk is being done on a positive dentry and and returns -EISDIR to indicate the dentry should be used as is without attempting an automount. But if autofs is expiring the dentry at the time it should be remounted following the expire. There are two cases, in the case of a "nobrowse" indirect autofs mount it would have been mounted on lookup anyway. In the case of a "browse" indirect or direct autofs mount re-mounting it will maintain the mount which is what user space would be expected. This will defer expiration of the mount which might lead to mounts unexpectedly remaining mounted under heavy stat activity but there's no other choice in order to maintain consistency for user space. Signed-off-by: Ian Kent --- fs/autofs/root.c | 10 +++++++++- fs/namei.c | 13 +++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/fs/autofs/root.c b/fs/autofs/root.c index a1c9c32e104f..308cc49aca1d 100644 --- a/fs/autofs/root.c +++ b/fs/autofs/root.c @@ -406,9 +406,17 @@ static int autofs_d_manage(const struct path *path, bool rcu_walk) /* Check for (possible) pending expire */ if (ino->flags & AUTOFS_INF_WANT_EXPIRE) { + /* dentry possibly going to be picked for expire, + * proceed to ref-walk mode. + */ if (rcu_walk) return -ECHILD; - return 0; + + /* ref-walk mode, return 1 so follow_automount() + * can to wait on the expire outcome and possibly + * attempt a re-mount. + */ + return 1; } /* diff --git a/fs/namei.c b/fs/namei.c index db6565c99825..34a03928d32d 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1227,11 +1227,20 @@ static int follow_automount(struct path *path, struct nameidata *nd, * mounted directory. Also, autofs may mark negative dentries * as being automount points. These will need the attentions * of the daemon to instantiate them before they can be used. + * + * Also if ->d_manage() returns 1 the dentry transit needs + * managing, for autofs it tells us the dentry might be expired, + * so proceed to ->d_automount(). */ if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY | LOOKUP_OPEN | LOOKUP_CREATE | LOOKUP_AUTOMOUNT)) && - path->dentry->d_inode) - return -EISDIR; + path->dentry->d_inode) { + if (path->dentry->d_flags & DCACHE_MANAGE_TRANSIT) { + if (!path->dentry->d_op->d_manage(path, false)) + return -EISDIR; + } else + return -EISDIR; + } nd->total_link_count++; if (nd->total_link_count >= 40) From patchwork Thu Mar 26 05:23:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Kent X-Patchwork-Id: 11459281 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 52293161F for ; Thu, 26 Mar 2020 05:32:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3B88F207FC for ; Thu, 26 Mar 2020 05:32:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727575AbgCZFcw (ORCPT ); Thu, 26 Mar 2020 01:32:52 -0400 Received: from icp-osb-irony-out5.external.iinet.net.au ([203.59.1.221]:30174 "EHLO icp-osb-irony-out5.external.iinet.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726279AbgCZFcw (ORCPT ); Thu, 26 Mar 2020 01:32:52 -0400 X-SMTP-MATCH: 0 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2CdAgBuO3xe/4G50HZgBh0BAQEJAREFBQGBaAcBCwEBgieBYRIqhBqPYAaBEjiJZ4ophSkUgWcKAQEBAQEBAQEBGxkBAgQBAYREAoIoJDUIDgIQAQEBBQEBAQEBBQMBbYUKWEIBDAGFFAYjBFIQGA0CGA4CAkcQBhOFfiSuIH8zGgKKToEOKgGMLhp5gQeBRAOBNoFmhDEKgyGCXgSNcIMDhw1FgQCXEIJGlwkdjzsDjCEtpluFeQE3gVhNLgqDJ1AYnH83MIEGAQGEGYklXwEB X-IPAS-Result: A2CdAgBuO3xe/4G50HZgBh0BAQEJAREFBQGBaAcBCwEBgieBYRIqhBqPYAaBEjiJZ4ophSkUgWcKAQEBAQEBAQEBGxkBAgQBAYREAoIoJDUIDgIQAQEBBQEBAQEBBQMBbYUKWEIBDAGFFAYjBFIQGA0CGA4CAkcQBhOFfiSuIH8zGgKKToEOKgGMLhp5gQeBRAOBNoFmhDEKgyGCXgSNcIMDhw1FgQCXEIJGlwkdjzsDjCEtpluFeQE3gVhNLgqDJ1AYnH83MIEGAQGEGYklXwEB X-IronPort-AV: E=Sophos;i="5.72,307,1580745600"; d="scan'208";a="304456596" Received: from unknown (HELO mickey.themaw.net) ([118.208.185.129]) by icp-osb-irony-out5.iinet.net.au with ESMTP; 26 Mar 2020 13:23:36 +0800 Subject: [PATCH 4/4] autofs: add comment about autofs_mountpoint_changed() From: Ian Kent To: Al Viro Cc: autofs mailing list , linux-fsdevel , Kernel Mailing List Date: Thu, 26 Mar 2020 13:23:36 +0800 Message-ID: <158520021604.5325.4342529050022426912.stgit@mickey.themaw.net> In-Reply-To: <158520019862.5325.7856909810909592388.stgit@mickey.themaw.net> References: <158520019862.5325.7856909810909592388.stgit@mickey.themaw.net> User-Agent: StGit/unknown-version MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org The function autofs_mountpoint_changed() is unusual, add a comment about two cases for which it is used. Signed-off-by: Ian Kent --- 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 308cc49aca1d..a972bbaecb46 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 a 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;