mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Kent <raven@themaw.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Staubach <staubach@redhat.com>,
	autofs mailing list <autofs@linux.kernel.org>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [autofs] [PATCH] autofs4: reinstate negatitive timeout of mount fails
Date: Wed, 22 Aug 2007 19:05:38 +0800	[thread overview]
Message-ID: <1187780738.3899.20.camel@raven.themaw.net> (raw)
In-Reply-To: <1187776503.3899.16.camel@raven.themaw.net>

On Wed, 2007-08-22 at 17:55 +0800, Ian Kent wrote:
> On Tue, 2007-08-21 at 10:19 -0400, Peter Staubach wrote:
> > Ian Kent wrote:
> > > Hi,
> > >
> > > Due to a change to fs/dcache.c:d_lookup() in the 2.6 kernel whereby only
> > > hashed dentrys are returned the negative caching of mount failures
> > > stopped working in the autofs4 module for nobrowse mount (ie. directory
> > > created at mount time and removed at umount or following a mount
> > > failure).
> > >
> > > This patch keeps track of the dentrys from mount fails in order to be
> > > able check the timeout since the last fail and return the appropriate
> > > status. In addition the timeout value is settable at load time as a
> > > module option and via sysfs using the module
> > > parameter /sys/module/autofs4/parameters/negative_timeout.
> > >
> > > Signed-off-by: Ian Kent <raven@themaw.net>
> > >
> > > ---
> > > --- linux-2.6.23-rc2-mm2/fs/autofs4/init.c.negative-timeout	2007-07-09 07:32:17.000000000 +0800
> > > +++ linux-2.6.23-rc2-mm2/fs/autofs4/init.c	2007-08-21 15:44:34.000000000 +0800
> > > @@ -14,6 +14,10 @@
> > >  #include <linux/init.h>
> > >  #include "autofs_i.h"
> > >  
> > > +unsigned int negative_timeout = AUTOFS_NEGATIVE_TIMEOUT;
> > > +module_param(negative_timeout, uint, S_IRUGO | S_IWUSR);
> > > +MODULE_PARM_DESC(negative_timeout, "Cache mount fails negatively for this many seconds");
> > > +
> > >  static int autofs_get_sb(struct file_system_type *fs_type,
> > >  	int flags, const char *dev_name, void *data, struct vfsmount *mnt)
> > >  {
> > > --- linux-2.6.23-rc2-mm2/fs/autofs4/inode.c.negative-timeout	2007-08-17 11:52:33.000000000 +0800
> > > +++ linux-2.6.23-rc2-mm2/fs/autofs4/inode.c	2007-08-21 15:44:34.000000000 +0800
> > > @@ -46,6 +46,7 @@ struct autofs_info *autofs4_init_ino(str
> > >  	ino->inode = NULL;
> > >  	ino->dentry = NULL;
> > >  	ino->size = 0;
> > > +	ino->negative_timeout = negative_timeout;
> > >  
> > >  	INIT_LIST_HEAD(&ino->rehash);
> > >  
> > > @@ -98,11 +99,24 @@ void autofs4_free_ino(struct autofs_info
> > >  static void autofs4_force_release(struct autofs_sb_info *sbi)
> > >  {
> > >  	struct dentry *this_parent = sbi->sb->s_root;
> > > -	struct list_head *next;
> > > +	struct list_head *p, *next;
> > >  
> > >  	if (!sbi->sb->s_root)
> > >  		return;
> > >  
> > > +	/* Cleanup the negative dentry cache */
> > > +	spin_lock(&sbi->rehash_lock);
> > > +	list_for_each_safe(p, next, &sbi->rehash_list) {
> > > +		struct autofs_info *ino;
> > > +		struct dentry *dentry;
> > > +		ino = list_entry(p, struct autofs_info, rehash);
> > > +		dentry = ino->dentry;
> > > +		spin_unlock(&sbi->rehash_lock);
> > > +		dput(ino->dentry);
> > >   
> > 
> > Should this be dput(dentry);?
> 
> Addressed in this simple (first) cleanup patch.
> 

Scratch that first cleanup.
I missed removing the definition of the no longer used dentry.
Please use this instead.
Ian

---
--- linux-2.6.23-rc2-mm2/fs/autofs4/inode.c.negative-timeout-cleanup	2007-08-22 17:46:33.000000000 +0800
+++ linux-2.6.23-rc2-mm2/fs/autofs4/inode.c	2007-08-22 18:57:49.000000000 +0800
@@ -108,9 +108,7 @@ static void autofs4_force_release(struct
 	spin_lock(&sbi->rehash_lock);
 	list_for_each_safe(p, next, &sbi->rehash_list) {
 		struct autofs_info *ino;
-		struct dentry *dentry;
 		ino = list_entry(p, struct autofs_info, rehash);
-		dentry = ino->dentry;
 		spin_unlock(&sbi->rehash_lock);
 		dput(ino->dentry);
 		spin_lock(&sbi->rehash_lock);



  reply	other threads:[~2007-08-22 11:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-21  9:26 Ian Kent
2007-08-21 14:19 ` Peter Staubach
2007-08-22  2:49   ` Ian Kent
2007-08-22  9:55   ` Ian Kent
2007-08-22 11:05     ` Ian Kent [this message]
2007-08-21 20:15 ` Andrew Morton
2007-08-22  2:56   ` Ian Kent
2007-08-22  3:27     ` [autofs] " 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=1187780738.3899.20.camel@raven.themaw.net \
    --to=raven@themaw.net \
    --cc=akpm@linux-foundation.org \
    --cc=autofs@linux.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=staubach@redhat.com \
    /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

all inboxes | Powered by JetHome®