public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@warthog.cambridge.redhat.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: David Howells <dhowells@cambridge.redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] VFS autmounter support
Date: Wed, 18 Jun 2003 09:37:06 +0100	[thread overview]
Message-ID: <18943.1055925426@warthog.warthog> (raw)
In-Reply-To: Message from "H. Peter Anvin" <hpa@zytor.com>  of "Tue, 17 Jun 2003 11:19:18 PDT." <3EEF5BA6.9030505@zytor.com>


> Namespaces have all kinds of problems anyway when mixed with
> automounting (it's not at all clear what the semantics should be, and
> I'm pretty sure that the semantics the current namespaces give are
> overall undersirable), but when I discussed this issue with Al Viro he
> indicated that you can always access all namespaces via procfs; if not,
> you *should* be able to...

You can't - at the moment anyway - necessarily access an entire
namespace... chroot, for example, may exclude part of it. This, however, may
not be a problem, except for fchdir might be able to put the current working
directory outside of your current root tree:

	fd = open("/afs/.cambridge.redhat.com",O_DIRECTORY);
	chdir("/sillyroot/");
	chroot("/sillyroot/");
	fchdir(fd);
	chdir("afsdoc");  <-- automount required

With my patch, this should just work because the VFS knows exactly where the
automount needs to be done, and merely requires a raw vfsmount struct to be
supplied by the filesystem.

> > Whatever happens, stat() must _not_ cause the automount point to mount.
> > 
> 
> That's actually not true.  It's lstat() that mustn't cause the automount
> point to mount -- stat() only comes into play if lstat() resolves to a
> symlink.  However, lstat() never invokes follow_link, so creating a
> dentry with a follow_link method resolving to itself, and an associated
> dummy directory inode, does what's required.

That _is_ actually true. Doing "ls -l" in that directory would otherwise cause
a mount storm.

follow_link resolving to itself? Surely that'll cause ELOOP very quickly? And
where does this "dummy directory inode" live?

> > Or do you mean do it actually inside dentry->d_op->d_revalidate()? But you
> > can't do it there because you don't know what vfsmount you are dealing
> > with.
> 
> I mean inside d_revalidate().

You can't do the mount inside d_revalidate(). You don't have enough
information.

> I don't see that it should be handed specially.

But it is special. It's a fs future if you will. If it's done at VFS level it
can be done a lot cleaner.

> >>a) how to guarantee that a large mount tree can be safely destroyed;
> > 
> > What do you mean by safely? I check that the usage count on vfsmount
> > structures is 1 under lock just before unlinking it - thereby making sure
> > that no one has a file open on it, no process has it as its root or cwd,
> > and that nothing is mounted upon it.
> 
> Not good enough.  You need to be able to tell that atomically for a full
> *tree*, that can contain multiple mounts, some of which have other
> mounts on top of them, not just for a single superblock.

_Why_ do I need to do that?

I currently degrade a tree from the leaves inwards, true, but the fact that
each layer then needs to wait for expiry can be improved.

I don't expire branches in the tree because the leaves and branches depending
from them pin them by way of their usage counts.

One thing I can't do is a tree unmount, but then we can't do that anyway:

	[root@host135 root]# df /home
	Filesystem           1k-blocks      Used Available Use% Mounted on
	automount(pid902)            0         0         0   -  /home
	[root@host135 root]# ls /home/
	[root@host135 root]# ls /home/dhowells/
	...
	[root@host135 root]# ls /home/
	dhowells
	[root@host135 root]# umount /home
	umount: /home: device is busy

umount can, perhaps, be made to try to do this by trying to rid the tree of
unused automount points, until either it finds something that is in use or is
not a mountpoint, or it manages to completely clear the subtree.

Unused leaves can be determined by checking mnt_count under the dcache lock -
if the count is 1, then the leaf can be removed.

> >>b) how to detect partial unmounts. 
> > 
> > What do you mean by a partial unmount?
> 
> /foo/bar is an automounted filesystem, which has /foo/bar/baz mounted on
> top of it.  Now the user manually umounts /foo/bar/baz (because of
> staleness, or whatever.)  Now the automount system needs to detect
> accesses to /foo/bar/baz and remount... effectively, /foo/bar/baz needs
> to atomically turn into an automounter point.

Yes... it does that. The dentry from the underlying filesystem is still there,
and resurfaces after the umount; and _that_ dentry is what marks this an
automount point (by virtue of its d_automount operation). So this is not a
problem.

David

  reply	other threads:[~2003-06-18  8:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-17 14:55 [PATCH] VFS autmounter support David Howells
2003-06-17 16:08 ` H. Peter Anvin
2003-06-17 18:07   ` David Howells
2003-06-17 18:19     ` H. Peter Anvin
2003-06-18  8:37       ` David Howells [this message]
2003-06-18  8:48         ` viro
2003-06-18 17:16         ` H. Peter Anvin
2003-06-19  7:20           ` David Howells
2003-06-19  7:30             ` H. Peter Anvin
2003-06-24 15:23               ` David Howells
2003-06-18  4:55 ` Linus Torvalds
2003-06-18  5:10   ` viro
2003-06-18  7:55     ` David Howells
2003-06-18  8:36       ` viro
2003-06-18 11:01         ` 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=18943.1055925426@warthog.warthog \
    --to=dhowells@warthog.cambridge.redhat.com \
    --cc=dhowells@cambridge.redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    /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