]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/nfs/super.c
V4L/DVB (6834): cx88-video: Enable selection of the WM8775 for cx88 cards
[linux-2.6-omap-h63xx.git] / fs / nfs / super.c
index b47e87e6c4063bafd708ce7a645effd0d32e0505..0b0c72a072ffd5c5c772a518d01db5a75fe4392a 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/sunrpc/stats.h>
 #include <linux/sunrpc/metrics.h>
 #include <linux/sunrpc/xprtsock.h>
+#include <linux/sunrpc/xprtrdma.h>
 #include <linux/nfs_fs.h>
 #include <linux/nfs_mount.h>
 #include <linux/nfs4_mount.h>
@@ -68,7 +69,7 @@ enum {
        Opt_ac, Opt_noac,
        Opt_lock, Opt_nolock,
        Opt_v2, Opt_v3,
-       Opt_udp, Opt_tcp,
+       Opt_udp, Opt_tcp, Opt_rdma,
        Opt_acl, Opt_noacl,
        Opt_rdirplus, Opt_nordirplus,
        Opt_sharecache, Opt_nosharecache,
@@ -114,6 +115,7 @@ static match_table_t nfs_mount_option_tokens = {
        { Opt_v3, "v3" },
        { Opt_udp, "udp" },
        { Opt_tcp, "tcp" },
+       { Opt_rdma, "rdma" },
        { Opt_acl, "acl" },
        { Opt_noacl, "noacl" },
        { Opt_rdirplus, "rdirplus" },
@@ -153,7 +155,7 @@ static match_table_t nfs_mount_option_tokens = {
 };
 
 enum {
-       Opt_xprt_udp, Opt_xprt_tcp,
+       Opt_xprt_udp, Opt_xprt_tcp, Opt_xprt_rdma,
 
        Opt_xprt_err
 };
@@ -161,6 +163,7 @@ enum {
 static match_table_t nfs_xprt_protocol_tokens = {
        { Opt_xprt_udp, "udp" },
        { Opt_xprt_tcp, "tcp" },
+       { Opt_xprt_rdma, "rdma" },
 
        { Opt_xprt_err, NULL }
 };
@@ -421,7 +424,7 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
                const char *nostr;
        } nfs_info[] = {
                { NFS_MOUNT_SOFT, ",soft", ",hard" },
-               { NFS_MOUNT_INTR, ",intr", "" },
+               { NFS_MOUNT_INTR, ",intr", ",nointr" },
                { NFS_MOUNT_NOCTO, ",nocto", "" },
                { NFS_MOUNT_NOAC, ",noac", "" },
                { NFS_MOUNT_NONLM, ",nolock", "" },
@@ -432,8 +435,6 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
        };
        const struct proc_nfs_info *nfs_infop;
        struct nfs_client *clp = nfss->nfs_client;
-       char buf[12];
-       const char *proto;
 
        seq_printf(m, ",vers=%d", clp->rpc_ops->version);
        seq_printf(m, ",rsize=%d", nfss->rsize);
@@ -452,18 +453,8 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
                else
                        seq_puts(m, nfs_infop->nostr);
        }
-       switch (nfss->client->cl_xprt->prot) {
-               case IPPROTO_TCP:
-                       proto = "tcp";
-                       break;
-               case IPPROTO_UDP:
-                       proto = "udp";
-                       break;
-               default:
-                       snprintf(buf, sizeof(buf), "%u", nfss->client->cl_xprt->prot);
-                       proto = buf;
-       }
-       seq_printf(m, ",proto=%s", proto);
+       seq_printf(m, ",proto=%s",
+                  rpc_peeraddr2str(nfss->client, RPC_DISPLAY_PROTO));
        seq_printf(m, ",timeo=%lu", 10U * clp->retrans_timeo / HZ);
        seq_printf(m, ",retrans=%u", clp->retrans_count);
        seq_printf(m, ",sec=%s", nfs_pseudoflavour_to_name(nfss->client->cl_auth->au_flavor));
@@ -680,6 +671,12 @@ static int nfs_parse_mount_options(char *raw,
                        mnt->timeo = 600;
                        mnt->retrans = 2;
                        break;
+               case Opt_rdma:
+                       mnt->flags |= NFS_MOUNT_TCP; /* for side protocols */
+                       mnt->nfs_server.protocol = XPRT_TRANSPORT_RDMA;
+                       mnt->timeo = 600;
+                       mnt->retrans = 2;
+                       break;
                case Opt_acl:
                        mnt->flags &= ~NFS_MOUNT_NOACL;
                        break;
@@ -895,6 +892,13 @@ static int nfs_parse_mount_options(char *raw,
                                mnt->timeo = 600;
                                mnt->retrans = 2;
                                break;
+                       case Opt_xprt_rdma:
+                               /* vector side protocols to TCP */
+                               mnt->flags |= NFS_MOUNT_TCP;
+                               mnt->nfs_server.protocol = XPRT_TRANSPORT_RDMA;
+                               mnt->timeo = 600;
+                               mnt->retrans = 2;
+                               break;
                        default:
                                goto out_unrec_xprt;
                        }
@@ -914,6 +918,7 @@ static int nfs_parse_mount_options(char *raw,
                        case Opt_xprt_tcp:
                                mnt->mount_server.protocol = XPRT_TRANSPORT_TCP;
                                break;
+                       case Opt_xprt_rdma: /* not used for side protocols */
                        default:
                                goto out_unrec_xprt;
                        }
@@ -1049,10 +1054,11 @@ static int nfs_validate_mount_data(void *options,
 {
        struct nfs_mount_data *data = (struct nfs_mount_data *)options;
 
+       memset(args, 0, sizeof(*args));
+
        if (data == NULL)
                goto out_no_data;
 
-       memset(args, 0, sizeof(*args));
        args->flags             = (NFS_MOUNT_VER3 | NFS_MOUNT_TCP);
        args->rsize             = NFS_MAX_FILE_IO_SIZE;
        args->wsize             = NFS_MAX_FILE_IO_SIZE;
@@ -1095,6 +1101,10 @@ static int nfs_validate_mount_data(void *options,
                if (mntfh->size < sizeof(mntfh->data))
                        memset(mntfh->data + mntfh->size, 0,
                               sizeof(mntfh->data) - mntfh->size);
+
+               if (!nfs_verify_server_address((struct sockaddr *) &data->addr))
+                       goto out_no_address;
+
                /*
                 * Translate to nfs_parsed_mount_data, which nfs_fill_super
                 * can deal with.
@@ -1126,6 +1136,10 @@ static int nfs_validate_mount_data(void *options,
                if (nfs_parse_mount_options((char *)options, args) == 0)
                        return -EINVAL;
 
+               if (!nfs_verify_server_address((struct sockaddr *)
+                                               &args->nfs_server.address))
+                       goto out_no_address;
+
                c = strchr(dev_name, ':');
                if (c == NULL)
                        return -EINVAL;
@@ -1154,10 +1168,6 @@ static int nfs_validate_mount_data(void *options,
                goto out_v3_not_compiled;
 #endif /* !CONFIG_NFS_V3 */
 
-       if (!nfs_verify_server_address((struct sockaddr *)
-                                               &args->nfs_server.address))
-               goto out_no_address;
-
        return 0;
 
 out_no_data:
@@ -1465,6 +1475,11 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
                error = PTR_ERR(mntroot);
                goto error_splat_super;
        }
+       if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
+               dput(mntroot);
+               error = -ESTALE;
+               goto error_splat_super;
+       }
 
        s->s_flags |= MS_ACTIVE;
        mnt->mnt_sb = s;
@@ -1522,10 +1537,11 @@ static int nfs4_validate_mount_data(void *options,
        struct nfs4_mount_data *data = (struct nfs4_mount_data *)options;
        char *c;
 
+       memset(args, 0, sizeof(*args));
+
        if (data == NULL)
                goto out_no_data;
 
-       memset(args, 0, sizeof(*args));
        args->rsize             = NFS_MAX_FILE_IO_SIZE;
        args->wsize             = NFS_MAX_FILE_IO_SIZE;
        args->timeo             = 600;
@@ -1810,6 +1826,11 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
                error = PTR_ERR(mntroot);
                goto error_splat_super;
        }
+       if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
+               dput(mntroot);
+               error = -ESTALE;
+               goto error_splat_super;
+       }
 
        s->s_flags |= MS_ACTIVE;
        mnt->mnt_sb = s;
@@ -1884,6 +1905,11 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
                error = PTR_ERR(mntroot);
                goto error_splat_super;
        }
+       if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
+               dput(mntroot);
+               error = -ESTALE;
+               goto error_splat_super;
+       }
 
        s->s_flags |= MS_ACTIVE;
        mnt->mnt_sb = s;