The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ian Kent <raven@themaw.net>
To: Jeff Moyer <jmoyer@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	autofs mailing list <autofs@linux.kernel.org>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Al Viro <viro@ZenIV.linux.org.uk>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 5/7] autofs4 - fix direct mount pending expire race
Date: Sat, 19 Jul 2008 15:21:03 +0800	[thread overview]
Message-ID: <1216452065.3210.25.camel@raven.themaw.net> (raw)
In-Reply-To: <1216433386.3210.16.camel@raven.themaw.net>


On Sat, 2008-07-19 at 10:09 +0800, Ian Kent wrote:
> On Fri, 2008-07-18 at 16:08 -0400, Jeff Moyer wrote:
> > 
> > This makes me uneasy.  This should take d_mounted to zero.  Then, when
> > the daemon actually does the unmount, won't the d_mounted drop below
> > zero?  Following calls to d_mountpoint will return a negative value, but
> > everyone treats it as a boolean, so it will evaluate to true for a brief
> > time.  Or did I miss something?
> 
> Yes, I thought about doing exactly that.
> 
> But the thing that effects d_mounted is mounted on the dentry and so
> d_mounted may be decremented during the expire. So if we set it
> explicitly it would be incorrect at the end. While the
> decrement/increment isn't always correct throughout the expire we need
> to handle the mount following in ->follow_link() anyway and then the
> decrement/increment ends up with the correct value once the expire is
> complete.
> 
> One problem that has occurred to me is that user space could could
> manually umount it just when we change it. So a follow up patch to add a
> lock around the increment/decrement in fs/namespace.c and
> fs/autofs4/expire.c is in order. I'm having a look at that now.

DOH, this is rubbish.

I often wonder why I forget what I've done so quickly.

Of course user space can't umount this because every process except the
daemon is blocked in ->follow_link() during the expire. But we can't
rely on the the return from user space and cannot know if the mount was
actually umounted so the decrement/increment will maintain the
status-quo. If d_mounted does become negative during the expire then we
will still be sent to ->follow_link() as follow_down() will fail.

Ian


  reply	other threads:[~2008-07-19  7:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-18  2:36 [PATCH 1/7] autofs4 - indirect dentry must almost always be positive Ian Kent
2008-07-18  2:37 ` [PATCH 2/7] autofs4 - cleanup redundant readir code Ian Kent
2008-07-18 14:47   ` Jeff Moyer
2008-07-18 15:26     ` Ian Kent
2008-07-18  2:37 ` [PATCH 3/7] autofs4 - fix pending checks Ian Kent
2008-07-18 14:51   ` Jeff Moyer
2008-07-18  2:37 ` [PATCH 4/7] autofs4 - fix indirect mount pending expire race Ian Kent
2008-07-18 18:52   ` Jeff Moyer
2008-07-18 18:56     ` Ian Kent
2008-07-18 19:14       ` Jeff Moyer
2008-07-18  2:37 ` [PATCH 5/7] autofs4 - fix direct " Ian Kent
2008-07-18 20:08   ` Jeff Moyer
2008-07-19  2:09     ` Ian Kent
2008-07-19  7:21       ` Ian Kent [this message]
2008-07-18  2:37 ` [PATCH 6/7] autofs4 - reorganize expire pending wait function calls Ian Kent
2008-07-18  2:37 ` [PATCH 7/7] autofs4 - remove unused ioctls Ian Kent
2008-07-18 20:09   ` Jeff Moyer
2008-07-18 11:56 ` [PATCH 1/7] autofs4 - indirect dentry must almost always be positive Jeff Moyer

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=1216452065.3210.25.camel@raven.themaw.net \
    --to=raven@themaw.net \
    --cc=akpm@linux-foundation.org \
    --cc=autofs@linux.kernel.org \
    --cc=jmoyer@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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