vfs: switch ->show_options() to struct dentry *
[deliverable/linux.git] / fs / nfs / super.c
index 480b3b6bf71ef82f122a433cbf3ec62d789c033a..e463967aafb8cf1d48be42e8c7b191cba607fbeb 100644 (file)
@@ -41,7 +41,6 @@
 #include <linux/lockd/bind.h>
 #include <linux/seq_file.h>
 #include <linux/mount.h>
-#include <linux/mnt_namespace.h>
 #include <linux/namei.h>
 #include <linux/nfs_idmap.h>
 #include <linux/vfs.h>
@@ -263,10 +262,10 @@ static match_table_t nfs_local_lock_tokens = {
 
 static void nfs_umount_begin(struct super_block *);
 static int  nfs_statfs(struct dentry *, struct kstatfs *);
-static int  nfs_show_options(struct seq_file *, struct vfsmount *);
-static int  nfs_show_devname(struct seq_file *, struct vfsmount *);
-static int  nfs_show_path(struct seq_file *, struct vfsmount *);
-static int  nfs_show_stats(struct seq_file *, struct vfsmount *);
+static int  nfs_show_options(struct seq_file *, struct dentry *);
+static int  nfs_show_devname(struct seq_file *, struct dentry *);
+static int  nfs_show_path(struct seq_file *, struct dentry *);
+static int  nfs_show_stats(struct seq_file *, struct dentry *);
 static struct dentry *nfs_fs_mount(struct file_system_type *,
                int, const char *, void *);
 static struct dentry *nfs_xdev_mount(struct file_system_type *fs_type,
@@ -721,9 +720,9 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
 /*
  * Describe the mount options on this VFS mountpoint
  */
-static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt)
+static int nfs_show_options(struct seq_file *m, struct dentry *root)
 {
-       struct nfs_server *nfss = NFS_SB(mnt->mnt_sb);
+       struct nfs_server *nfss = NFS_SB(root->d_sb);
 
        nfs_show_mount_options(m, nfss, 0);
 
@@ -761,14 +760,14 @@ static void show_pnfs(struct seq_file *m, struct nfs_server *server) {}
 #endif
 #endif
 
-static int nfs_show_devname(struct seq_file *m, struct vfsmount *mnt)
+static int nfs_show_devname(struct seq_file *m, struct dentry *root)
 {
        char *page = (char *) __get_free_page(GFP_KERNEL);
        char *devname, *dummy;
        int err = 0;
        if (!page)
                return -ENOMEM;
-       devname = nfs_path(&dummy, mnt->mnt_root, page, PAGE_SIZE);
+       devname = nfs_path(&dummy, root, page, PAGE_SIZE);
        if (IS_ERR(devname))
                err = PTR_ERR(devname);
        else
@@ -777,7 +776,7 @@ static int nfs_show_devname(struct seq_file *m, struct vfsmount *mnt)
        return err;
 }
 
-static int nfs_show_path(struct seq_file *m, struct vfsmount *mnt)
+static int nfs_show_path(struct seq_file *m, struct dentry *dentry)
 {
        seq_puts(m, "/");
        return 0;
@@ -786,10 +785,10 @@ static int nfs_show_path(struct seq_file *m, struct vfsmount *mnt)
 /*
  * Present statistical information for this VFS mountpoint
  */
-static int nfs_show_stats(struct seq_file *m, struct vfsmount *mnt)
+static int nfs_show_stats(struct seq_file *m, struct dentry *root)
 {
        int i, cpu;
-       struct nfs_server *nfss = NFS_SB(mnt->mnt_sb);
+       struct nfs_server *nfss = NFS_SB(root->d_sb);
        struct rpc_auth *auth = nfss->client->cl_auth;
        struct nfs_iostats totals = { };
 
@@ -799,10 +798,10 @@ static int nfs_show_stats(struct seq_file *m, struct vfsmount *mnt)
         * Display all mount option settings
         */
        seq_printf(m, "\n\topts:\t");
-       seq_puts(m, mnt->mnt_sb->s_flags & MS_RDONLY ? "ro" : "rw");
-       seq_puts(m, mnt->mnt_sb->s_flags & MS_SYNCHRONOUS ? ",sync" : "");
-       seq_puts(m, mnt->mnt_sb->s_flags & MS_NOATIME ? ",noatime" : "");
-       seq_puts(m, mnt->mnt_sb->s_flags & MS_NODIRATIME ? ",nodiratime" : "");
+       seq_puts(m, root->d_sb->s_flags & MS_RDONLY ? "ro" : "rw");
+       seq_puts(m, root->d_sb->s_flags & MS_SYNCHRONOUS ? ",sync" : "");
+       seq_puts(m, root->d_sb->s_flags & MS_NOATIME ? ",noatime" : "");
+       seq_puts(m, root->d_sb->s_flags & MS_NODIRATIME ? ",nodiratime" : "");
        nfs_show_mount_options(m, nfss, 1);
 
        seq_printf(m, "\n\tage:\t%lu", (jiffies - nfss->mount_time) / HZ);
@@ -2787,43 +2786,22 @@ static void nfs_referral_loop_unprotect(void)
 static struct dentry *nfs_follow_remote_path(struct vfsmount *root_mnt,
                const char *export_path)
 {
-       struct mnt_namespace *ns_private;
-       struct super_block *s;
        struct dentry *dentry;
-       struct path path;
-       int ret;
+       int err;
 
-       ns_private = create_mnt_ns(root_mnt);
-       ret = PTR_ERR(ns_private);
-       if (IS_ERR(ns_private))
-               goto out_mntput;
+       if (IS_ERR(root_mnt))
+               return ERR_CAST(root_mnt);
 
-       ret = nfs_referral_loop_protect();
-       if (ret != 0)
-               goto out_put_mnt_ns;
-
-       ret = vfs_path_lookup(root_mnt->mnt_root, root_mnt,
-                       export_path, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT, &path);
+       err = nfs_referral_loop_protect();
+       if (err) {
+               mntput(root_mnt);
+               return ERR_PTR(err);
+       }
 
+       dentry = mount_subtree(root_mnt, export_path);
        nfs_referral_loop_unprotect();
-       put_mnt_ns(ns_private);
-
-       if (ret != 0)
-               goto out_err;
-
-       s = path.mnt->mnt_sb;
-       atomic_inc(&s->s_active);
-       dentry = dget(path.dentry);
 
-       path_put(&path);
-       down_write(&s->s_umount);
        return dentry;
-out_put_mnt_ns:
-       put_mnt_ns(ns_private);
-out_mntput:
-       mntput(root_mnt);
-out_err:
-       return ERR_PTR(ret);
 }
 
 static struct dentry *nfs4_try_mount(int flags, const char *dev_name,
@@ -2841,9 +2819,7 @@ static struct dentry *nfs4_try_mount(int flags, const char *dev_name,
                        data->nfs_server.hostname);
        data->nfs_server.export_path = export_path;
 
-       res = ERR_CAST(root_mnt);
-       if (!IS_ERR(root_mnt))
-               res = nfs_follow_remote_path(root_mnt, export_path);
+       res = nfs_follow_remote_path(root_mnt, export_path);
 
        dfprintk(MOUNT, "<-- nfs4_try_mount() = %ld%s\n",
                        IS_ERR(res) ? PTR_ERR(res) : 0,
@@ -3104,9 +3080,7 @@ static struct dentry *nfs4_referral_mount(struct file_system_type *fs_type,
                        flags, data, data->hostname);
        data->mnt_path = export_path;
 
-       res = ERR_CAST(root_mnt);
-       if (!IS_ERR(root_mnt))
-               res = nfs_follow_remote_path(root_mnt, export_path);
+       res = nfs_follow_remote_path(root_mnt, export_path);
        dprintk("<-- nfs4_referral_mount() = %ld%s\n",
                        IS_ERR(res) ? PTR_ERR(res) : 0,
                        IS_ERR(res) ? " [error]" : "");
This page took 0.029559 seconds and 5 git commands to generate.