linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* desired autofs semantics (was: Announcing Trapfs...)
@ 2004-11-05  8:03 Adam J. Richter
  2004-11-05 17:22 ` Mike Waychison
  0 siblings, 1 reply; 3+ messages in thread
From: Adam J. Richter @ 2004-11-05  8:03 UTC (permalink / raw)
  To: Michael.Waychison; +Cc: linux-fsdevel, thockin

Mike Waychison wrote:
>[...] trying to 'expire' data, which is neccesary for
>autofs-like functionality..

	I think it would be useful to have some sort of time stamp in
either the superblock or the vfsmount to indicate the last time the
tree was accessed, and then have some way for an auto-unmount program
run from cron to read these timestamps.

	For an autofs application, such a scheme would probably not
need any additional kernel help with race conditions, because if a
user accesses the file system between the time umount interrogates and
the time umount tries to do the unmount, it should still be harmless
to try the umount, regardless of whether the umount succeeds or fails.
Since, if the umount succeeds but the directory has just come back
into use, the directory will get automounted again.


>Also wrt autofs functionality, this lacks the ability to 'trap' on the
>root directory of a filesystem and the ability to 'ghost' directories
>and only perform actions when they are walked into. See the autofsng
>tree at http://autofsng.bkbits.net/linux-2.6-autofsng to see how I do
>this using ->follow_link traps.

	I get file not found when I give my web browser that URL.

	I think I only partly understand what your describing.  I am
going to guess that the semantics are that if I stat() the mount
point, I will receive fake information, but that information will
indicate that this root inode is a *directory*.  If I "cd" to it,
something might or might not be triggered, but if I do a "getdirents"
of that root directory, that will trigger some kind of automatic
remounting.

	If that is exactly functionality that you want, then the
lookup trapping extension for tmpfs probably will not do it for you.
However, perhaps you could write a really tiny file system that just
has a root inode that has a follow_link function that calls
call_fs_helper() and then adjusts nameidata if something has been
overlayed on its mount point after call_fs_helper has run.  Perhaps it
might also want to hold a semaphore somewhere to serialize similar
requests.

	By the way, if you don't mind seeing *symlinks* for nodes that
are not mounted, you might be able to use the tmpfs lookup trapping
without any kernel changes.  By having a non-trapping /auto directory
that contains a symlinks into to the actual trapping tmpfs.

	If you wanted to be a bit fancier, the user level helper
script to remove the appropriate symlink from /auto, create a
directory in /auto, and put a symlink back in the tmpfs directory
to /auto so that the access that triggered the user level helper will
succeed return.

	You could set it up like this:

% mount -t tmpfs x /public
% mount -t tmpfs -o helper='/sbin/my-autofs-helper /detector /public' x /detector
% ln -s /detector/{host1,host2,host3,host4} /public/

	...where /sbin/my-autofs-helper would look something like this:

#!/bin/sh
echo "$0 $*" > /dev/pts/1
host=$4
detector=$1/$host
public=$2/$host
# $3 is "LOOKUP"
rm -f $public
ssln $public $detector
mkdir $public
mount -t nfs $host:/ $public

	I tried this configuration, modified to mount new tmpfs
partitions instead of using nfs.  I noticed some drawbacks to this use
of lookup trapping that you probably don't want.  If you do "ls -lF
/auto", two things will happen which are probably not ideally what you
want from a user interface standpoint:

	1. The "ls -lF /auto"  will trigger mounting of all of the
	   subtrees, because "ls -F" will stat the destination of
	   each symlink to decide if it should put a trailing "/"
	   on the name.

	2. The first time you do "ls -lF", you will see a list of symlinks
	   that point to directories, but, attempts after that (now that
	   all those links have been mounted) will give you a list of
	   directories.

	Neither of these behaviors is incorrect based on what the
directory lookup traps do, but it's probably not what you want if you
are trying to set up a finite predefined list of automatic points,
that the user is supposed to be able to interrogate without triggering
a mount.


[...]
>> 	3. Until the trapfs helper exits, it is impossible to
>> control-C out of the access that invoked the helper.  This is a
>> deficiency of the synchronous call_usermodehelper interface.  Every
>> kernel facility that uses call_usermodhelper has his problem.  There
>> are a number of ways to fix synchronous call_usermodehelper, and I
>> surely expect trapfs to use whatever solution is implemented.
>> 

>Autofs NG also has this issue. I'm still considering what it would take
>to push this call into a schedule_work invocation. I don't think a
>call_usermodehelper_interruptible is what is needed.

	Why not?

                    __     ______________
Adam J. Richter        \ /
adam@yggdrasil.com      | g g d r a s i l

^ permalink raw reply	[flat|nested] 3+ messages in thread
* Re: desired autofs semantics (was: Announcing Trapfs...)
@ 2004-11-05 19:12 Adam J. Richter
  0 siblings, 0 replies; 3+ messages in thread
From: Adam J. Richter @ 2004-11-05 19:12 UTC (permalink / raw)
  To: Michael.Waychison; +Cc: linux-fsdevel, thockin

Michael Waychison wrote:
>> #!/bin/sh
>> echo "$0 $*" > /dev/pts/1
>> host=$4
>> detector=$1/$host
>> public=$2/$host
>> # $3 is "LOOKUP"
>> rm -f $public
>> ssln $public $detector

>what is ssln?

	An "ln -s" program that does not stat() the target first.
I think it stands for "statically-linked symoblic link", because
it is distributed as a static binary for emergency recovery if
broken too many shared library links or something.

                    __     ______________
Adam J. Richter        \ /
adam@yggdrasil.com      | g g d r a s i l

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-11-05 20:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-05  8:03 desired autofs semantics (was: Announcing Trapfs...) Adam J. Richter
2004-11-05 17:22 ` Mike Waychison
  -- strict thread matches above, loose matches on Subject: below --
2004-11-05 19:12 Adam J. Richter

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