intrinsic automount and mountpoint degradation support
PATCH 1/1 intrinsic automount and mountpoint degradation support
Hi Linus, Andrew,
Here's a patch that I worked out with Al Viro that adds support for a filesystem (such as kAFS) to perform automounting intrinsically without the need for a userspace daemon. It also adds support for such mountpoints to be degraded at the filesystem's behest until they've been untouched long enough that they'll be removed.
I've a patch (to follow) that removes some #ifdef's from fs/afs/* thus allowing it to make use of this facility.
David
fs/namei.c +6 -0
@@ -278,6 +278,12 @@mntput (nd->mnt); } +void path_release_on_umount (struct nameidata *nd) +{ +dput (nd->dentry); +_mntput (nd->mnt); +} +/* * Internal lookup() using the new generic dcache. * SMP-safe
fs/namespace.c +149 -19
275 lines not on this page · raw message
fs/super.c +3 -0
@@ -788,6 +788,7 @@ mnt->mnt_root =dget (sb->s_root); mnt->mnt_mountpoint = sb->s_root; mnt->mnt_parent = mnt; + mnt->mnt_namespace = current->namespace;up_write (&sb->s_umount);put_filesystem (type);return mnt;
@@ -804,6 +805,8 @@return (struct vfsmount *)sb; } +EXPORT_SYMBOL_GPL (do_kern_mount); +struct vfsmount *kern_mount (struct file_system_type *type) {return do_kern_mount (type->name,0 , type->name,NULL );
include/linux/fs.h +1 -0
@@ -714,6 +714,7 @@#define MNT_FORCE 0x00000001/* Attempt to forcibily umount */ #define MNT_DETACH 0x00000002/* Just detach from the tree */ +#define MNT_EXPIRE 0x00000004/* Mark for expiry */ extern struct list_head super_blocks;extern spinlock_t sb_lock;
include/linux/mount.h +20 -1
@@ -29,8 +29,11 @@struct list_head mnt_child;/* and going through their mnt_child */ atomic_t mnt_count;int mnt_flags; +int mnt_expiry_mark;/* true if marked for expiry */ char *mnt_devname;/* Name of device e.g. /dev/dsk/hda1 */ struct list_head mnt_list; +struct list_head mnt_fslink;/* link in fs-specific expiry list */ +struct namespace *mnt_namespace;/* containing namespace */ };static inline struct vfsmount *mntget (struct vfsmount *mnt)
@@ -42,7 +45,7 @@extern void __mntput (struct vfsmount *mnt); -static inline void mntput (struct vfsmount *mnt) +static inline void _mntput (struct vfsmount *mnt) {if (mnt) {if (atomic_dec_and_test (&mnt->mnt_count))
@@ -50,10 +53,26 @@ } } +static inline void mntput (struct vfsmount *mnt) +{ +if (mnt) { + mnt->mnt_expiry_mark =0 ; +_mntput (mnt); + } +} +extern void free_vfsmnt (struct vfsmount *mnt);extern struct vfsmount *alloc_vfsmnt (const char *name);extern struct vfsmount *do_kern_mount (const char *fstype,int flags,const char *name,void *data); + +struct nameidata ; + +extern int do_add_mount (struct vfsmount *newmnt,struct nameidata *nd, +int mnt_flags,struct list_head *fslist); + +extern void mark_mounts_for_expiry (struct list_head *mounts); +extern spinlock_t vfsmount_lock;#endif
include/linux/namei.h +1 -0
@@ -57,6 +57,7 @@extern int FASTCALL (path_walk (const char *,struct nameidata *));extern int FASTCALL (link_path_walk (const char *,struct nameidata *));extern void path_release (struct nameidata *); +extern void path_release_on_umount (struct nameidata *);extern struct dentry *lookup_one_len (const char *,struct dentry *,int );extern struct dentry *lookup_hash (struct qstr *,struct dentry *);
include/linux/namespace.h +1 -1
@@ -14,7 +14,7 @@extern void umount_tree (struct vfsmount *);extern int copy_namespace (int ,struct task_struct *); -void __put_namespace (struct namespace *namespace); +extern void __put_namespace (struct namespace *namespace);static inline void put_namespace (struct namespace *namespace) {