linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@gmail.com>
To: David Howells <dhowells@redhat.com>
Cc: npiggin@kernel.dk, viro@zeniv.linux.org.uk, raven@themaw.net,
	autofs@linux.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 01/18] Add a dentry op to handle automounting rather than abusing follow_link()
Date: Thu, 13 Jan 2011 16:10:17 +1100	[thread overview]
Message-ID: <AANLkTi=YygMc2ExFxvWqiFbSr-bWRVcn17toanJBdR08@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=F6PSgQs78MpmG_V3q_ksmYMUwU8=xBoNOypto@mail.gmail.com>

On Thu, Jan 13, 2011 at 2:53 PM, Nick Piggin <npiggin@gmail.com> wrote:
> On Wed, Jan 12, 2011 at 4:48 AM, David Howells <dhowells@redhat.com> wrote:
>> Add a dentry op (d_automount) to handle automounting directories rather than
>> abusing the follow_link() inode operation.  The operation is keyed off a new
>> inode flag (S_AUTOMOUNT).
>>
>> This makes it easier to add an AT_ flag to suppress terminal segment automount
>> during pathwalk.  It should also remove the need for the kludge code in the
>> pathwalk algorithm to handle directories with follow_link() semantics.
>>
>> A new pathwalk subroutine, follow_automount() is added to handle mountpoints.
>> It will return -EREMOTE if the S_AUTOMOUNT was set, but no d_automount() op was
>> supplied, -ELOOP if we've encountered too many symlinks or mountpoints, -EISDIR
>> if the walk point should be used without mounting and 0 if successful.  path
>> will be updated if an automount took place to point to the mounted filesystem.
>>
>> I've only changed __follow_mount() to handle call follow_automount(), but it
>> might be necessary to change follow_mount() too.  The latter is only called
>> from follow_dotdot(), but any automounts on ".." should be pinned whilst we're
>> using a child of it.
>>
>> I've also extracted the mount/don't-mount logic from autofs4 and included it
>> here.  It makes the mount go ahead anyway if someone calls open() or creat(),
>> tries to traverse the directory, tries to chdir/chroot/etc. into the directory,
>> or sticks a '/' on the end of the pathname.  If they do a stat(), however,
>> they'll only trigger the automount if they didn't also say O_NOFOLLOW.
>>
>> Signed-off-by: David Howells <dhowells@redhat.com>
>> Acked-by: Ian Kent <raven@themaw.net>
>
> I would still prefer to see a .follow_mount API, and not tie in this automount
> specific inode detail to what could be a more flexible dentry-only API.
>
> The default NULL implementation would do nothing, and follow_automount
> stuff can be in fs/libfs.c to be used by filesystem, rather than fs/namei.c.

Looking further in the patchset at the d_managed "thing", that's almost what
I'm getting at.

But I don't see why any of this stuff has to happen in fs/namei.c. Just call the
function from path walk, and provide helpers in libfs or something if there is
a lot of common code between autofs4 and others (and leave it autofs specifc
when that is the case).

Of course, that would be the obvious and naive first approach. So really my
question is why did that not work? And can we make it work?

Second observation when adding rcu-walk/ref-walk operations. What we've
done now (which is what Linus preferred and I agree with now) is to make
functions always able to accept rcu-walk mode, and have filesystems bail
out as needed.

Unless there are really fundamental reasons why rcu-walk won't work (eg.
->lookup, if it is required to do allocations and IO), or if it really
doesn't matter
(eg. a function to be called once to set up a mount, and never again).
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-01-13  5:10 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-11 17:48 [PATCH 00/18] Introduce automount support in the VFS David Howells
2011-01-11 17:48 ` [PATCH 01/18] Add a dentry op to handle automounting rather than abusing follow_link() David Howells
2011-01-13  3:53   ` Nick Piggin
2011-01-13  5:10     ` Nick Piggin [this message]
2011-01-13 15:12     ` David Howells
2011-01-14  1:19       ` Nick Piggin
2011-01-14 16:24         ` Al Viro
2011-01-14 22:14           ` Nick Piggin
2011-01-13 12:20   ` David Howells
2011-01-14  1:04     ` Nick Piggin
2011-01-14  9:24     ` David Howells
2011-01-11 17:48 ` [PATCH 02/18] AFS: Use d_automount() " David Howells
2011-01-11 17:48 ` [PATCH 03/18] NFS: " David Howells
2011-01-11 17:48 ` [PATCH 04/18] CIFS: " David Howells
2011-01-11 17:48 ` [PATCH 05/18] Remove the automount through follow_link() kludge code from pathwalk David Howells
2011-01-11 17:48 ` [PATCH 06/18] Add an AT_NO_AUTOMOUNT flag to suppress terminal automount David Howells
2011-01-11 17:48 ` [PATCH 07/18] Add more dentry flags for special function directories David Howells
2011-01-11 17:48 ` [PATCH 08/18] Make follow_down() handle d_manage() David Howells
2011-01-11 17:48 ` [PATCH 09/18] autofs4: Add d_automount() dentry operation David Howells
2011-01-11 17:49 ` [PATCH 10/18] autofs4: Add d_manage() " David Howells
2011-01-11 17:49 ` [PATCH 11/18] autofs4: Remove unused code David Howells
2011-01-11 17:49 ` [PATCH 12/18] autofs4: Clean up inode operations David Howells
2011-01-11 17:49 ` [PATCH 13/18] autofs4: Clean up dentry operations David Howells
2011-01-11 17:49 ` [PATCH 14/18] autofs4: Clean up autofs4_free_ino() David Howells
2011-01-11 17:49 ` [PATCH 15/18] autofs4: Fix wait validation David Howells
2011-01-11 17:49 ` [PATCH 16/18] autofs4: Add v4 pseudo direct mount support David Howells
2011-01-11 17:49 ` [PATCH 17/18] autofs4: Bump version David Howells
2011-01-11 17:49 ` [PATCH 18/18] Remove a further kludge from __do_follow_link() David Howells
2011-01-12 13:52 ` [PATCH 07/18] Add more dentry flags for special function directories [UPDATE] David Howells
2011-01-12 19:16 ` [PATCH 00/18] Introduce automount support in the VFS David Howells

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='AANLkTi=YygMc2ExFxvWqiFbSr-bWRVcn17toanJBdR08@mail.gmail.com' \
    --to=npiggin@gmail.com \
    --cc=autofs@linux.kernel.org \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=npiggin@kernel.dk \
    --cc=raven@themaw.net \
    --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;
as well as URLs for NNTP newsgroup(s).