2005-09-09 20:04:20 +00:00
|
|
|
/*
|
|
|
|
* linux/fs/9p/vfs_super.c
|
|
|
|
*
|
|
|
|
* This file contians superblock ops for 9P2000. It is intended that
|
|
|
|
* you mount this file system on directories.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
|
|
|
|
* Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
2006-03-25 11:07:28 +00:00
|
|
|
* it under the terms of the GNU General Public License version 2
|
|
|
|
* as published by the Free Software Foundation.
|
2005-09-09 20:04:20 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to:
|
|
|
|
* Free Software Foundation
|
|
|
|
* 51 Franklin Street, Fifth Floor
|
|
|
|
* Boston, MA 02111-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <linux/file.h>
|
|
|
|
#include <linux/stat.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/inet.h>
|
|
|
|
#include <linux/pagemap.h>
|
|
|
|
#include <linux/seq_file.h>
|
|
|
|
#include <linux/mount.h>
|
|
|
|
#include <linux/idr.h>
|
Detach sched.h from mm.h
First thing mm.h does is including sched.h solely for can_do_mlock() inline
function which has "current" dereference inside. By dealing with can_do_mlock()
mm.h can be detached from sched.h which is good. See below, why.
This patch
a) removes unconditional inclusion of sched.h from mm.h
b) makes can_do_mlock() normal function in mm/mlock.c
c) exports can_do_mlock() to not break compilation
d) adds sched.h inclusions back to files that were getting it indirectly.
e) adds less bloated headers to some files (asm/signal.h, jiffies.h) that were
getting them indirectly
Net result is:
a) mm.h users would get less code to open, read, preprocess, parse, ... if
they don't need sched.h
b) sched.h stops being dependency for significant number of files:
on x86_64 allmodconfig touching sched.h results in recompile of 4083 files,
after patch it's only 3744 (-8.3%).
Cross-compile tested on
all arm defconfigs, all mips defconfigs, all powerpc defconfigs,
alpha alpha-up
arm
i386 i386-up i386-defconfig i386-allnoconfig
ia64 ia64-up
m68k
mips
parisc parisc-up
powerpc powerpc-up
s390 s390-up
sparc sparc-up
sparc64 sparc64-up
um-x86_64
x86_64 x86_64-up x86_64-defconfig x86_64-allnoconfig
as well as my two usual configs.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-20 21:22:52 +00:00
|
|
|
#include <linux/sched.h>
|
2009-04-24 07:06:53 +00:00
|
|
|
#include <linux/smp_lock.h>
|
2007-07-10 22:57:28 +00:00
|
|
|
#include <net/9p/9p.h>
|
|
|
|
#include <net/9p/client.h>
|
2005-09-09 20:04:20 +00:00
|
|
|
|
|
|
|
#include "v9fs.h"
|
|
|
|
#include "v9fs_vfs.h"
|
|
|
|
#include "fid.h"
|
|
|
|
|
|
|
|
static void v9fs_clear_inode(struct inode *);
|
2007-02-12 08:55:41 +00:00
|
|
|
static const struct super_operations v9fs_super_ops;
|
2005-09-09 20:04:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* v9fs_clear_inode - release an inode
|
|
|
|
* @inode: inode to release
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void v9fs_clear_inode(struct inode *inode)
|
|
|
|
{
|
|
|
|
filemap_fdatawrite(inode->i_mapping);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* v9fs_set_super - set the superblock
|
|
|
|
* @s: super block
|
|
|
|
* @data: file system specific data
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int v9fs_set_super(struct super_block *s, void *data)
|
|
|
|
{
|
|
|
|
s->s_fs_info = data;
|
|
|
|
return set_anon_super(s, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* v9fs_fill_super - populate superblock with info
|
|
|
|
* @sb: superblock
|
|
|
|
* @v9ses: session information
|
2008-03-05 13:08:09 +00:00
|
|
|
* @flags: flags propagated from v9fs_get_sb()
|
2005-09-09 20:04:20 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
|
|
|
|
int flags)
|
|
|
|
{
|
|
|
|
sb->s_maxbytes = MAX_LFS_FILESIZE;
|
|
|
|
sb->s_blocksize_bits = fls(v9ses->maxdata - 1);
|
|
|
|
sb->s_blocksize = 1 << sb->s_blocksize_bits;
|
|
|
|
sb->s_magic = V9FS_MAGIC;
|
|
|
|
sb->s_op = &v9fs_super_ops;
|
|
|
|
|
|
|
|
sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC |
|
2006-01-10 04:52:15 +00:00
|
|
|
MS_NOATIME;
|
2005-09-09 20:04:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* v9fs_get_sb - mount a superblock
|
|
|
|
* @fs_type: file system type
|
|
|
|
* @flags: mount flags
|
|
|
|
* @dev_name: device name that was mounted
|
|
|
|
* @data: mount options
|
[PATCH] VFS: Permit filesystem to override root dentry on mount
Extend the get_sb() filesystem operation to take an extra argument that
permits the VFS to pass in the target vfsmount that defines the mountpoint.
The filesystem is then required to manually set the superblock and root dentry
pointers. For most filesystems, this should be done with simple_set_mnt()
which will set the superblock pointer and then set the root dentry to the
superblock's s_root (as per the old default behaviour).
The get_sb() op now returns an integer as there's now no need to return the
superblock pointer.
This patch permits a superblock to be implicitly shared amongst several mount
points, such as can be done with NFS to avoid potential inode aliasing. In
such a case, simple_set_mnt() would not be called, and instead the mnt_root
and mnt_sb would be set directly.
The patch also makes the following changes:
(*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
pointer argument and return an integer, so most filesystems have to change
very little.
(*) If one of the convenience function is not used, then get_sb() should
normally call simple_set_mnt() to instantiate the vfsmount. This will
always return 0, and so can be tail-called from get_sb().
(*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
dcache upon superblock destruction rather than shrink_dcache_anon().
This is required because the superblock may now have multiple trees that
aren't actually bound to s_root, but that still need to be cleaned up. The
currently called functions assume that the whole tree is rooted at s_root,
and that anonymous dentries are not the roots of trees which results in
dentries being left unculled.
However, with the way NFS superblock sharing are currently set to be
implemented, these assumptions are violated: the root of the filesystem is
simply a dummy dentry and inode (the real inode for '/' may well be
inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
with child trees.
[*] Anonymous until discovered from another tree.
(*) The documentation has been adjusted, including the additional bit of
changing ext2_* into foo_* in the documentation.
[akpm@osdl.org: convert ipath_fs, do other stuff]
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Nathan Scott <nathans@sgi.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-23 09:02:57 +00:00
|
|
|
* @mnt: mountpoint record to be instantiated
|
2005-09-09 20:04:20 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
[PATCH] VFS: Permit filesystem to override root dentry on mount
Extend the get_sb() filesystem operation to take an extra argument that
permits the VFS to pass in the target vfsmount that defines the mountpoint.
The filesystem is then required to manually set the superblock and root dentry
pointers. For most filesystems, this should be done with simple_set_mnt()
which will set the superblock pointer and then set the root dentry to the
superblock's s_root (as per the old default behaviour).
The get_sb() op now returns an integer as there's now no need to return the
superblock pointer.
This patch permits a superblock to be implicitly shared amongst several mount
points, such as can be done with NFS to avoid potential inode aliasing. In
such a case, simple_set_mnt() would not be called, and instead the mnt_root
and mnt_sb would be set directly.
The patch also makes the following changes:
(*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
pointer argument and return an integer, so most filesystems have to change
very little.
(*) If one of the convenience function is not used, then get_sb() should
normally call simple_set_mnt() to instantiate the vfsmount. This will
always return 0, and so can be tail-called from get_sb().
(*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
dcache upon superblock destruction rather than shrink_dcache_anon().
This is required because the superblock may now have multiple trees that
aren't actually bound to s_root, but that still need to be cleaned up. The
currently called functions assume that the whole tree is rooted at s_root,
and that anonymous dentries are not the roots of trees which results in
dentries being left unculled.
However, with the way NFS superblock sharing are currently set to be
implemented, these assumptions are violated: the root of the filesystem is
simply a dummy dentry and inode (the real inode for '/' may well be
inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
with child trees.
[*] Anonymous until discovered from another tree.
(*) The documentation has been adjusted, including the additional bit of
changing ext2_* into foo_* in the documentation.
[akpm@osdl.org: convert ipath_fs, do other stuff]
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Nathan Scott <nathans@sgi.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-23 09:02:57 +00:00
|
|
|
static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
|
|
|
|
const char *dev_name, void *data,
|
|
|
|
struct vfsmount *mnt)
|
2005-09-09 20:04:20 +00:00
|
|
|
{
|
|
|
|
struct super_block *sb = NULL;
|
|
|
|
struct inode *inode = NULL;
|
|
|
|
struct dentry *root = NULL;
|
|
|
|
struct v9fs_session_info *v9ses = NULL;
|
2008-10-16 13:30:07 +00:00
|
|
|
struct p9_wstat *st = NULL;
|
2005-09-09 20:04:20 +00:00
|
|
|
int mode = S_IRWXUGO | S_ISVTX;
|
2008-11-13 23:38:44 +00:00
|
|
|
uid_t uid = current_fsuid();
|
|
|
|
gid_t gid = current_fsgid();
|
2007-07-10 22:57:28 +00:00
|
|
|
struct p9_fid *fid;
|
2005-09-09 20:04:20 +00:00
|
|
|
int retval = 0;
|
|
|
|
|
2007-07-10 22:57:28 +00:00
|
|
|
P9_DPRINTK(P9_DEBUG_VFS, " \n");
|
2005-09-09 20:04:20 +00:00
|
|
|
|
2007-11-06 14:02:53 +00:00
|
|
|
st = NULL;
|
2006-01-08 09:05:02 +00:00
|
|
|
v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL);
|
2005-09-09 20:04:20 +00:00
|
|
|
if (!v9ses)
|
[PATCH] VFS: Permit filesystem to override root dentry on mount
Extend the get_sb() filesystem operation to take an extra argument that
permits the VFS to pass in the target vfsmount that defines the mountpoint.
The filesystem is then required to manually set the superblock and root dentry
pointers. For most filesystems, this should be done with simple_set_mnt()
which will set the superblock pointer and then set the root dentry to the
superblock's s_root (as per the old default behaviour).
The get_sb() op now returns an integer as there's now no need to return the
superblock pointer.
This patch permits a superblock to be implicitly shared amongst several mount
points, such as can be done with NFS to avoid potential inode aliasing. In
such a case, simple_set_mnt() would not be called, and instead the mnt_root
and mnt_sb would be set directly.
The patch also makes the following changes:
(*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
pointer argument and return an integer, so most filesystems have to change
very little.
(*) If one of the convenience function is not used, then get_sb() should
normally call simple_set_mnt() to instantiate the vfsmount. This will
always return 0, and so can be tail-called from get_sb().
(*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
dcache upon superblock destruction rather than shrink_dcache_anon().
This is required because the superblock may now have multiple trees that
aren't actually bound to s_root, but that still need to be cleaned up. The
currently called functions assume that the whole tree is rooted at s_root,
and that anonymous dentries are not the roots of trees which results in
dentries being left unculled.
However, with the way NFS superblock sharing are currently set to be
implemented, these assumptions are violated: the root of the filesystem is
simply a dummy dentry and inode (the real inode for '/' may well be
inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
with child trees.
[*] Anonymous until discovered from another tree.
(*) The documentation has been adjusted, including the additional bit of
changing ext2_* into foo_* in the documentation.
[akpm@osdl.org: convert ipath_fs, do other stuff]
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Nathan Scott <nathans@sgi.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-23 09:02:57 +00:00
|
|
|
return -ENOMEM;
|
2005-09-09 20:04:20 +00:00
|
|
|
|
2007-07-10 22:57:28 +00:00
|
|
|
fid = v9fs_session_init(v9ses, dev_name, data);
|
|
|
|
if (IS_ERR(fid)) {
|
|
|
|
retval = PTR_ERR(fid);
|
2008-05-09 01:26:37 +00:00
|
|
|
goto close_session;
|
2007-07-10 22:57:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
st = p9_client_stat(fid);
|
|
|
|
if (IS_ERR(st)) {
|
|
|
|
retval = PTR_ERR(st);
|
2008-05-09 01:26:37 +00:00
|
|
|
goto clunk_fid;
|
2005-09-09 20:04:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sb = sget(fs_type, NULL, v9fs_set_super, v9ses);
|
[PATCH] VFS: Permit filesystem to override root dentry on mount
Extend the get_sb() filesystem operation to take an extra argument that
permits the VFS to pass in the target vfsmount that defines the mountpoint.
The filesystem is then required to manually set the superblock and root dentry
pointers. For most filesystems, this should be done with simple_set_mnt()
which will set the superblock pointer and then set the root dentry to the
superblock's s_root (as per the old default behaviour).
The get_sb() op now returns an integer as there's now no need to return the
superblock pointer.
This patch permits a superblock to be implicitly shared amongst several mount
points, such as can be done with NFS to avoid potential inode aliasing. In
such a case, simple_set_mnt() would not be called, and instead the mnt_root
and mnt_sb would be set directly.
The patch also makes the following changes:
(*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
pointer argument and return an integer, so most filesystems have to change
very little.
(*) If one of the convenience function is not used, then get_sb() should
normally call simple_set_mnt() to instantiate the vfsmount. This will
always return 0, and so can be tail-called from get_sb().
(*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
dcache upon superblock destruction rather than shrink_dcache_anon().
This is required because the superblock may now have multiple trees that
aren't actually bound to s_root, but that still need to be cleaned up. The
currently called functions assume that the whole tree is rooted at s_root,
and that anonymous dentries are not the roots of trees which results in
dentries being left unculled.
However, with the way NFS superblock sharing are currently set to be
implemented, these assumptions are violated: the root of the filesystem is
simply a dummy dentry and inode (the real inode for '/' may well be
inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
with child trees.
[*] Anonymous until discovered from another tree.
(*) The documentation has been adjusted, including the additional bit of
changing ext2_* into foo_* in the documentation.
[akpm@osdl.org: convert ipath_fs, do other stuff]
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Nathan Scott <nathans@sgi.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-23 09:02:57 +00:00
|
|
|
if (IS_ERR(sb)) {
|
|
|
|
retval = PTR_ERR(sb);
|
2008-05-09 01:26:37 +00:00
|
|
|
goto free_stat;
|
[PATCH] VFS: Permit filesystem to override root dentry on mount
Extend the get_sb() filesystem operation to take an extra argument that
permits the VFS to pass in the target vfsmount that defines the mountpoint.
The filesystem is then required to manually set the superblock and root dentry
pointers. For most filesystems, this should be done with simple_set_mnt()
which will set the superblock pointer and then set the root dentry to the
superblock's s_root (as per the old default behaviour).
The get_sb() op now returns an integer as there's now no need to return the
superblock pointer.
This patch permits a superblock to be implicitly shared amongst several mount
points, such as can be done with NFS to avoid potential inode aliasing. In
such a case, simple_set_mnt() would not be called, and instead the mnt_root
and mnt_sb would be set directly.
The patch also makes the following changes:
(*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
pointer argument and return an integer, so most filesystems have to change
very little.
(*) If one of the convenience function is not used, then get_sb() should
normally call simple_set_mnt() to instantiate the vfsmount. This will
always return 0, and so can be tail-called from get_sb().
(*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
dcache upon superblock destruction rather than shrink_dcache_anon().
This is required because the superblock may now have multiple trees that
aren't actually bound to s_root, but that still need to be cleaned up. The
currently called functions assume that the whole tree is rooted at s_root,
and that anonymous dentries are not the roots of trees which results in
dentries being left unculled.
However, with the way NFS superblock sharing are currently set to be
implemented, these assumptions are violated: the root of the filesystem is
simply a dummy dentry and inode (the real inode for '/' may well be
inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
with child trees.
[*] Anonymous until discovered from another tree.
(*) The documentation has been adjusted, including the additional bit of
changing ext2_* into foo_* in the documentation.
[akpm@osdl.org: convert ipath_fs, do other stuff]
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Nathan Scott <nathans@sgi.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-23 09:02:57 +00:00
|
|
|
}
|
2005-09-09 20:04:20 +00:00
|
|
|
v9fs_fill_super(sb, v9ses, flags);
|
|
|
|
|
|
|
|
inode = v9fs_get_inode(sb, S_IFDIR | mode);
|
|
|
|
if (IS_ERR(inode)) {
|
|
|
|
retval = PTR_ERR(inode);
|
2008-05-09 01:26:37 +00:00
|
|
|
goto release_sb;
|
2005-09-09 20:04:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inode->i_uid = uid;
|
|
|
|
inode->i_gid = gid;
|
|
|
|
|
|
|
|
root = d_alloc_root(inode);
|
|
|
|
if (!root) {
|
2009-05-06 05:35:04 +00:00
|
|
|
iput(inode);
|
2005-09-09 20:04:20 +00:00
|
|
|
retval = -ENOMEM;
|
2008-05-09 01:26:37 +00:00
|
|
|
goto release_sb;
|
2005-09-09 20:04:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sb->s_root = root;
|
2007-07-10 22:57:28 +00:00
|
|
|
root->d_inode->i_ino = v9fs_qid2ino(&st->qid);
|
2008-10-16 13:30:07 +00:00
|
|
|
|
2007-07-10 22:57:28 +00:00
|
|
|
v9fs_stat2inode(st, root->d_inode, sb);
|
2008-10-16 13:30:07 +00:00
|
|
|
|
2007-07-10 22:57:28 +00:00
|
|
|
v9fs_fid_add(root, fid);
|
2008-10-16 13:30:07 +00:00
|
|
|
p9stat_free(st);
|
2007-11-06 14:02:53 +00:00
|
|
|
kfree(st);
|
2005-09-09 20:04:20 +00:00
|
|
|
|
2009-03-04 20:06:34 +00:00
|
|
|
P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n");
|
|
|
|
simple_set_mnt(mnt, sb);
|
|
|
|
return 0;
|
2005-09-09 20:04:20 +00:00
|
|
|
|
2008-05-09 01:26:37 +00:00
|
|
|
release_sb:
|
2009-05-06 05:34:22 +00:00
|
|
|
deactivate_locked_super(sb);
|
2006-04-11 05:54:06 +00:00
|
|
|
|
2008-05-09 01:26:37 +00:00
|
|
|
free_stat:
|
|
|
|
kfree(st);
|
|
|
|
|
|
|
|
clunk_fid:
|
|
|
|
p9_client_clunk(fid);
|
|
|
|
|
|
|
|
close_session:
|
|
|
|
v9fs_session_close(v9ses);
|
|
|
|
kfree(v9ses);
|
|
|
|
|
[PATCH] VFS: Permit filesystem to override root dentry on mount
Extend the get_sb() filesystem operation to take an extra argument that
permits the VFS to pass in the target vfsmount that defines the mountpoint.
The filesystem is then required to manually set the superblock and root dentry
pointers. For most filesystems, this should be done with simple_set_mnt()
which will set the superblock pointer and then set the root dentry to the
superblock's s_root (as per the old default behaviour).
The get_sb() op now returns an integer as there's now no need to return the
superblock pointer.
This patch permits a superblock to be implicitly shared amongst several mount
points, such as can be done with NFS to avoid potential inode aliasing. In
such a case, simple_set_mnt() would not be called, and instead the mnt_root
and mnt_sb would be set directly.
The patch also makes the following changes:
(*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
pointer argument and return an integer, so most filesystems have to change
very little.
(*) If one of the convenience function is not used, then get_sb() should
normally call simple_set_mnt() to instantiate the vfsmount. This will
always return 0, and so can be tail-called from get_sb().
(*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
dcache upon superblock destruction rather than shrink_dcache_anon().
This is required because the superblock may now have multiple trees that
aren't actually bound to s_root, but that still need to be cleaned up. The
currently called functions assume that the whole tree is rooted at s_root,
and that anonymous dentries are not the roots of trees which results in
dentries being left unculled.
However, with the way NFS superblock sharing are currently set to be
implemented, these assumptions are violated: the root of the filesystem is
simply a dummy dentry and inode (the real inode for '/' may well be
inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
with child trees.
[*] Anonymous until discovered from another tree.
(*) The documentation has been adjusted, including the additional bit of
changing ext2_* into foo_* in the documentation.
[akpm@osdl.org: convert ipath_fs, do other stuff]
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Nathan Scott <nathans@sgi.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-23 09:02:57 +00:00
|
|
|
return retval;
|
2005-09-09 20:04:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* v9fs_kill_super - Kill Superblock
|
|
|
|
* @s: superblock
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void v9fs_kill_super(struct super_block *s)
|
|
|
|
{
|
|
|
|
struct v9fs_session_info *v9ses = s->s_fs_info;
|
|
|
|
|
2007-07-10 22:57:28 +00:00
|
|
|
P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s);
|
2005-09-09 20:04:20 +00:00
|
|
|
|
|
|
|
v9fs_dentry_release(s->s_root); /* clunk root */
|
|
|
|
|
|
|
|
kill_anon_super(s);
|
|
|
|
|
|
|
|
v9fs_session_close(v9ses);
|
|
|
|
kfree(v9ses);
|
2007-07-10 22:57:28 +00:00
|
|
|
P9_DPRINTK(P9_DEBUG_VFS, "exiting kill_super\n");
|
2005-09-09 20:04:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* v9fs_show_options - Show mount options in /proc/mounts
|
|
|
|
* @m: seq_file to write to
|
|
|
|
* @mnt: mount descriptor
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int v9fs_show_options(struct seq_file *m, struct vfsmount *mnt)
|
|
|
|
{
|
|
|
|
struct v9fs_session_info *v9ses = mnt->mnt_sb->s_fs_info;
|
|
|
|
|
2007-10-17 19:31:07 +00:00
|
|
|
seq_printf(m, "%s", v9ses->options);
|
2005-09-09 20:04:20 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-09-09 20:04:23 +00:00
|
|
|
static void
|
2008-04-24 11:21:56 +00:00
|
|
|
v9fs_umount_begin(struct super_block *sb)
|
2005-09-09 20:04:23 +00:00
|
|
|
{
|
2009-04-24 07:06:53 +00:00
|
|
|
struct v9fs_session_info *v9ses;
|
2005-09-09 20:04:23 +00:00
|
|
|
|
2009-04-24 07:06:53 +00:00
|
|
|
lock_kernel();
|
|
|
|
v9ses = sb->s_fs_info;
|
2008-04-24 11:21:56 +00:00
|
|
|
v9fs_session_cancel(v9ses);
|
2009-04-24 07:06:53 +00:00
|
|
|
unlock_kernel();
|
2005-09-09 20:04:23 +00:00
|
|
|
}
|
|
|
|
|
2007-02-12 08:55:41 +00:00
|
|
|
static const struct super_operations v9fs_super_ops = {
|
2005-09-09 20:04:20 +00:00
|
|
|
.statfs = simple_statfs,
|
|
|
|
.clear_inode = v9fs_clear_inode,
|
|
|
|
.show_options = v9fs_show_options,
|
2005-09-09 20:04:23 +00:00
|
|
|
.umount_begin = v9fs_umount_begin,
|
2005-09-09 20:04:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct file_system_type v9fs_fs_type = {
|
2006-03-25 11:07:29 +00:00
|
|
|
.name = "9p",
|
2005-09-09 20:04:20 +00:00
|
|
|
.get_sb = v9fs_get_sb,
|
|
|
|
.kill_sb = v9fs_kill_super,
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
};
|