From: Ian Kent <raven@themaw.net>
To: Miklos Szeredi <mszeredi@suse.cz>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
Miklos Szeredi <miklos@szeredi.hu>,
rwheeler@redhat.com, avati@redhat.com, bfoster@redhat.com,
dhowells@redhat.com, eparis@redhat.com,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp>
Subject: Re: [PATCH 0/9] [RFC v2] safely drop directory dentry on failed revalidate
Date: Fri, 30 Aug 2013 07:44:12 +0800 [thread overview]
Message-ID: <1377819852.2355.28.camel@perseus.fritz.box> (raw)
In-Reply-To: <1377818677.2355.25.camel@perseus.fritz.box>
On Fri, 2013-08-30 at 07:24 +0800, Ian Kent wrote:
> On Thu, 2013-08-29 at 05:51 +0200, Miklos Szeredi wrote:
> > Ian,
> >
> > I'm having problems fully understanding what autofs4 is trying to do
> > with have_submounts().
>
> OK, I don't really care how I do it so I'm happy to change.
>
> >
> >
> > > On Wed, 2013-08-21 at 06:40 +0100, Al Viro wrote:
> >
> > > fs/autofs4/dev-ioctl.c:542: err = have_submounts(path.dentry);
> >
> > This is an ioctl() asking whether we have anything mounted on the autofs
> > mount. Using have_submounts() and then a separate follow_down() looks
> > racy. have_submounts() could succeed and then follow_down() could fail.
> > Or the other way round. Shouldn't the two cases be handled separately
> > here? If the autofs is a just a simple trigger then use follow_down().
> > If it's a multi-mount thing, then use have_submounts().
>
> Right but IIRC I don't think I actually use the returned s_magic ATM but
> I use the return of have_submounts() a lot.
>
> >
> > What is the userspace automount daemon using this for? Do we really
> > need the recursive check for submounts?
> >
> >
> > > fs/autofs4/root.c:381: if (have_submounts(dentry)) {
> >
> > Here it explicitly says it's for v5 and for rootless mutli-mount. So
> > for example:
> >
> > /mnt/auto/ root of an indirect mount
>
> or the root of direct mount for that matter.
>
> > /mnt/auto/foo directory with DCACHE_NEED_AUTOMOUNT
> > /mnt/auto/foo/bar directory without DCACHE_NEED_AUTOMOUNT
> > /mnt/auto/foo/bar/baz directory with an automount trigger mounted on it
> >
> > In this case when d_automount for "foo" is called we don't call the
> > userspace daemon because things are mounted under foo. If there was no
> > trigger under baz, then we would try to handle "foo" as an indirect
> > mount and call userspace.
> >
> > But it's pretty confusing. Do we really *ever* need to call automount
> > on "foo" if it was part of a multi-mount thing?
>
> That's right, the directory isn't simple_empty() so there's no callback.
>
> The problem is we can't just use the fact that the directory is empty to
> determine that there are no mounts at all underneath.
>
> I understand your thinking, about deciding whether to callback to the
> daemon, but that's not what the ioctl above is used for.
>
> The main use is to be able to find out if the given directory is a
> mountpoint as defined by the description in the comment above the
> function. This saves having to scan the mount table to find out and is a
> huge saving on systems with lots of mounts. In the past I've often
> needed an answer the question "is this an autofs mount or some other
> type" and that's why I stick s_magic in the return as well.
>
> >
> > > fs/autofs4/waitq.c:338: if (have_submounts(dentry))
> >
> > And here we re-validate the thing after taking another autofs4 lock.
> > Why this double checking?
>
> This is a different case and is often not in play at times when autofs
> is checking if the directory is a "mountpoint". Such as when trying to
> re-construct a tree of mounts at startup.
>
> The check in waitq.c above "is" used to validate the need to callback to
> the daemon to request a mount.
>
> As I said, any suggestions how to achieve this without calling
> have_submounts() are welcome.
You know, may_umount_tree() would do this for me (I think) and would be
much less expensive ....
>
> Ian
>
next prev parent reply other threads:[~2013-08-29 23:44 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-08 15:24 [PATCH 0/9] [RFC v2] safely drop directory dentry on failed revalidate Miklos Szeredi
2013-08-08 15:24 ` [PATCH 1/9] vfs: check submounts and drop atomically Miklos Szeredi
2013-08-12 13:27 ` Jeff Layton
2013-08-08 15:24 ` [PATCH 2/9] vfs: check unlinked ancestors before mount Miklos Szeredi
2013-08-12 13:33 ` Jeff Layton
2013-08-08 15:24 ` [PATCH 3/9] afs: use check_submounts_and_drop() Miklos Szeredi
2013-08-08 15:24 ` [PATCH 4/9] gfs2: " Miklos Szeredi
2013-08-08 15:24 ` [PATCH 5/9] nfs: " Miklos Szeredi
2013-08-12 13:34 ` Jeff Layton
2013-08-08 15:24 ` [PATCH 6/9] sysfs: " Miklos Szeredi
2013-08-08 15:24 ` [PATCH 7/9] fuse: use d_materialise_unique() Miklos Szeredi
2013-08-08 15:24 ` [PATCH 8/9] fuse: clean up return in fuse_dentry_revalidate() Miklos Szeredi
2013-08-08 15:24 ` [PATCH 9/9] fuse: drop dentry on failed revalidate Miklos Szeredi
2013-08-21 5:40 ` [PATCH 0/9] [RFC v2] safely drop directory " Al Viro
2013-08-21 20:04 ` Ryusuke Konishi
2013-08-21 21:00 ` Al Viro
2013-08-21 23:47 ` Ryusuke Konishi
2013-08-29 3:51 ` Miklos Szeredi
2013-08-29 23:24 ` Ian Kent
2013-08-29 23:44 ` Ian Kent [this message]
2013-08-30 8:59 ` Miklos Szeredi
2013-09-01 0:56 ` Ian Kent
2013-09-01 1:00 ` 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=1377819852.2355.28.camel@perseus.fritz.box \
--to=raven@themaw.net \
--cc=avati@redhat.com \
--cc=bfoster@redhat.com \
--cc=dhowells@redhat.com \
--cc=eparis@redhat.com \
--cc=konishi.ryusuke@lab.ntt.co.jp \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=mszeredi@suse.cz \
--cc=rwheeler@redhat.com \
--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