linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Kent <raven@themaw.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Tomohiro Kusumi <kusumi.tomohiro@gmail.com>,
	autofs mailing list <autofs@vger.kernel.org>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 7/7] autofs - take more care to not update last_used on path walk
Date: Mon, 30 Jan 2017 18:21:11 +0800	[thread overview]
Message-ID: <148577167169.9801.1377050092212016834.stgit@pluto.themaw.net> (raw)
In-Reply-To: <148577164094.9801.4775075118014742496.stgit@pluto.themaw.net>

GUI environments seem to be becoming more agressive at scanning
filesystems, to the point where autofs cannot expire mounts at
all.

This is one key reason the update of the autofs dentry info
last_used field is done in the expire system when the dentry
is seen to be in use.

But somewhere along the way instances of the update has crept
back into the autofs path walk functions which, with the more
aggressive file access patterns, is preventing expiration.

Changing the update in the path walk functions allows autofs
to at least make progress in spite of frequent immediate
re-mounts from file accesses.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 fs/autofs4/root.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index a11f731..6ddd4fa 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -281,8 +281,8 @@ static int autofs4_mount_wait(struct dentry *dentry, bool rcu_walk)
 		pr_debug("waiting for mount name=%pd\n", dentry);
 		status = autofs4_wait(sbi, dentry, NFY_MOUNT);
 		pr_debug("mount wait done status=%d\n", status);
+		ino->last_used = jiffies;
 	}
-	ino->last_used = jiffies;
 	return status;
 }
 
@@ -319,16 +319,21 @@ static struct dentry *autofs4_mountpoint_changed(struct path *path)
 	 */
 	if (autofs_type_indirect(sbi->type) && d_unhashed(dentry)) {
 		struct dentry *parent = dentry->d_parent;
-		struct autofs_info *ino;
 		struct dentry *new;
 
 		new = d_lookup(parent, &dentry->d_name);
 		if (!new)
 			return NULL;
-		ino = autofs4_dentry_ino(new);
-		ino->last_used = jiffies;
-		dput(path->dentry);
-		path->dentry = new;
+		if (new == dentry)
+			dput(new);
+		else {
+			struct autofs_info *ino;
+
+			ino = autofs4_dentry_ino(new);
+			ino->last_used = jiffies;
+			dput(path->dentry);
+			path->dentry = new;
+		}
 	}
 	return path->dentry;
 }


      parent reply	other threads:[~2017-01-30 10:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-30 10:20 [PATCH 1/7] autofs: remove wrong comment Ian Kent
2017-01-30 10:20 ` [PATCH 2/7] autofs: fix typo in Documentation Ian Kent
2017-01-30 10:20 ` [PATCH 3/7] autofs: fix wrong ioctl documentation regarding devid Ian Kent
2017-01-30 10:20 ` [PATCH 4/7] autofs: update ioctl documentation regarding struct autofs_dev_ioctl Ian Kent
2017-01-30 10:21 ` [PATCH 5/7] autofs: add command enum/macros for root-dir ioctls Ian Kent
2017-01-30 10:21 ` [PATCH 6/7] autofs: remove duplicated AUTOFS_DEV_IOCTL_SIZE definition Ian Kent
2017-01-30 10:21 ` Ian Kent [this message]

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=148577167169.9801.1377050092212016834.stgit@pluto.themaw.net \
    --to=raven@themaw.net \
    --cc=akpm@linux-foundation.org \
    --cc=autofs@vger.kernel.org \
    --cc=kusumi.tomohiro@gmail.com \
    --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 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).