Re: [PATCH 0/9] [RFC v2] safely drop directory dentry on failedrevalidate

From: Miklos Szeredi
Date: Wed Aug 28 2013 - 23:51:33 EST


Ian,

I'm having problems fully understanding what autofs4 is trying to do
with have_submounts().


> 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().

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
/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?

> 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?

Thanks,
Miklos

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/