nfsd4: use list_move in move_to_confirmed
[safe/jmp/linux-2.6] / fs / 9p / vfs_super.c
index a9d7d08..806da5d 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/mount.h>
 #include <linux/idr.h>
 #include <linux/sched.h>
+#include <linux/slab.h>
 #include <net/9p/9p.h>
 #include <net/9p/client.h>
 
 #include "v9fs_vfs.h"
 #include "fid.h"
 
-static void v9fs_clear_inode(struct inode *);
 static const struct super_operations v9fs_super_ops;
 
 /**
- * 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
@@ -81,16 +70,19 @@ static int v9fs_set_super(struct super_block *s, void *data)
 
 static void
 v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
-               int flags)
+               int flags, void *data)
 {
        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_bdi = &v9ses->bdi;
 
        sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC |
            MS_NOATIME;
+
+       save_mount_options(sb, data);
 }
 
 /**
@@ -113,14 +105,11 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
        struct v9fs_session_info *v9ses = NULL;
        struct p9_wstat *st = NULL;
        int mode = S_IRWXUGO | S_ISVTX;
-       uid_t uid = current_fsuid();
-       gid_t gid = current_fsgid();
        struct p9_fid *fid;
        int retval = 0;
 
        P9_DPRINTK(P9_DEBUG_VFS, " \n");
 
-       st = NULL;
        v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL);
        if (!v9ses)
                return -ENOMEM;
@@ -142,7 +131,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
                retval = PTR_ERR(sb);
                goto free_stat;
        }
-       v9fs_fill_super(sb, v9ses, flags);
+       v9fs_fill_super(sb, v9ses, flags, data);
 
        inode = v9fs_get_inode(sb, S_IFDIR | mode);
        if (IS_ERR(inode)) {
@@ -150,9 +139,6 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
                goto release_sb;
        }
 
-       inode->i_uid = uid;
-       inode->i_gid = gid;
-
        root = d_alloc_root(inode);
        if (!root) {
                iput(inode);
@@ -173,10 +159,8 @@ P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n");
        simple_set_mnt(mnt, sb);
        return 0;
 
-release_sb:
-       deactivate_locked_super(sb);
-
 free_stat:
+       p9stat_free(st);
        kfree(st);
 
 clunk_fid:
@@ -185,7 +169,12 @@ clunk_fid:
 close_session:
        v9fs_session_close(v9ses);
        kfree(v9ses);
+       return retval;
 
+release_sb:
+       p9stat_free(st);
+       kfree(st);
+       deactivate_locked_super(sb);
        return retval;
 }
 
@@ -201,43 +190,35 @@ static void v9fs_kill_super(struct super_block *s)
 
        P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s);
 
-       v9fs_dentry_release(s->s_root); /* clunk root */
+       if (s->s_root)
+               v9fs_dentry_release(s->s_root); /* clunk root */
 
        kill_anon_super(s);
 
+       v9fs_session_cancel(v9ses);
        v9fs_session_close(v9ses);
        kfree(v9ses);
+       s->s_fs_info = NULL;
        P9_DPRINTK(P9_DEBUG_VFS, "exiting kill_super\n");
 }
 
-/**
- * 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;
-       if (v9ses->options != NULL)
-               seq_printf(m, ",%s", v9ses->options);
-       return 0;
-}
-
 static void
 v9fs_umount_begin(struct super_block *sb)
 {
        struct v9fs_session_info *v9ses;
 
        v9ses = sb->s_fs_info;
-       v9fs_session_cancel(v9ses);
+       v9fs_session_begin_cancel(v9ses);
 }
 
 static const struct super_operations v9fs_super_ops = {
+#ifdef CONFIG_9P_FSCACHE
+       .alloc_inode = v9fs_alloc_inode,
+       .destroy_inode = v9fs_destroy_inode,
+#endif
        .statfs = simple_statfs,
        .clear_inode = v9fs_clear_inode,
-       .show_options = v9fs_show_options,
+       .show_options = generic_show_options,
        .umount_begin = v9fs_umount_begin,
 };