]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
NFSv4.2: Added NFS v4.2 support to the NFS client
authorSteve Dickson <steved@redhat.com>
Wed, 22 May 2013 16:50:38 +0000 (12:50 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 30 May 2013 15:33:14 +0000 (11:33 -0400)
This enable NFSv4.2 support. To enable this code the
CONFIG_NFS_V4_2 Kconfig define needs to be set and
the -o v4.2 mount option need to be used.

Signed-off-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/Kconfig
fs/nfs/callback.c
fs/nfs/callback_xdr.c
fs/nfs/nfs4client.c
fs/nfs/nfs4proc.c
fs/nfs/super.c
include/linux/nfs4.h

index 13ca196385f5faff6c88fd32e00d317cf68dcbd7..a048928340a7e188dbc67c9251cac9b16207baec 100644 (file)
@@ -104,6 +104,15 @@ config NFS_V4_1
 
          If unsure, say N.
 
+config NFS_V4_2
+       bool "NFS client support for NFSv4.2"
+       depends on NFS_V4_1
+       help
+         This option enables support for minor version 2 of the NFSv4 protocol
+         in the kernel's NFS client.
+
+         If unsure, say N.
+
 config PNFS_FILE_LAYOUT
        tristate
        depends on NFS_V4_1
index cff089a412c7f4bde3bd2f1d5138a4679535b772..78e368d8186d179aaf4e2e191ff93af796f90eb8 100644 (file)
@@ -282,6 +282,7 @@ static int nfs_callback_up_net(int minorversion, struct svc_serv *serv, struct n
                        ret = nfs4_callback_up_net(serv, net);
                        break;
                case 1:
+               case 2:
                        ret = nfs41_callback_up_net(serv, net);
                        break;
                default:
index 59461c957d9d7ed7204e09f9fad1aa0b154d8486..e7ee6292981169fe2a3447ea90b1f8c07342dd64 100644 (file)
@@ -166,9 +166,9 @@ static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound
        if (unlikely(p == NULL))
                return htonl(NFS4ERR_RESOURCE);
        hdr->minorversion = ntohl(*p++);
-       /* Check minor version is zero or one. */
-       if (hdr->minorversion <= 1) {
-               hdr->cb_ident = ntohl(*p++); /* ignored by v4.1 */
+       /* Check minor version is zero or one or two. */
+       if (hdr->minorversion <= 2) {
+               hdr->cb_ident = ntohl(*p++); /* ignored by v4.1 and v4.2 */
        } else {
                pr_warn_ratelimited("NFS: %s: NFSv4 server callback with "
                        "illegal minor version %u!\n",
index 947b0c908aa908c643140dd7087b0927753c6d49..2a297eeda4744919609f12f9d3155db91463842f 100644 (file)
@@ -66,6 +66,11 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
        if (err)
                goto error;
 
+       if (cl_init->minorversion > NFS4_MAX_MINOR_VERSION) {
+               err = -EINVAL;
+               goto error;
+       }
+
        spin_lock_init(&clp->cl_lock);
        INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state);
        rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client");
index 8fbc100541154cbd31253dc261eb5eaafbe71e29..abf46f4b5d19c50cd8d055c749d745551fe2b2fc 100644 (file)
@@ -7004,11 +7004,26 @@ static const struct nfs4_minor_version_ops nfs_v4_1_minor_ops = {
 };
 #endif
 
+#if defined(CONFIG_NFS_V4_2)
+static const struct nfs4_minor_version_ops nfs_v4_2_minor_ops = {
+       .minor_version = 2,
+       .call_sync = nfs4_call_sync_sequence,
+       .match_stateid = nfs41_match_stateid,
+       .find_root_sec = nfs41_find_root_sec,
+       .reboot_recovery_ops = &nfs41_reboot_recovery_ops,
+       .nograce_recovery_ops = &nfs41_nograce_recovery_ops,
+       .state_renewal_ops = &nfs41_state_renewal_ops,
+};
+#endif
+
 const struct nfs4_minor_version_ops *nfs_v4_minor_ops[] = {
        [0] = &nfs_v4_0_minor_ops,
 #if defined(CONFIG_NFS_V4_1)
        [1] = &nfs_v4_1_minor_ops,
 #endif
+#if defined(CONFIG_NFS_V4_2)
+       [2] = &nfs_v4_2_minor_ops,
+#endif
 };
 
 const struct inode_operations nfs4_dir_inode_operations = {
index c1bbb53d444ae11d22768271c95d2d540e64067f..2e94f2168b0308c2f40c209fac15992691bf2997 100644 (file)
@@ -269,7 +269,7 @@ static match_table_t nfs_local_lock_tokens = {
 
 enum {
        Opt_vers_2, Opt_vers_3, Opt_vers_4, Opt_vers_4_0,
-       Opt_vers_4_1,
+       Opt_vers_4_1, Opt_vers_4_2,
 
        Opt_vers_err
 };
@@ -280,6 +280,7 @@ static match_table_t nfs_vers_tokens = {
        { Opt_vers_4, "4" },
        { Opt_vers_4_0, "4.0" },
        { Opt_vers_4_1, "4.1" },
+       { Opt_vers_4_2, "4.2" },
 
        { Opt_vers_err, NULL }
 };
@@ -1097,6 +1098,10 @@ static int nfs_parse_version_string(char *string,
                mnt->version = 4;
                mnt->minorversion = 1;
                break;
+       case Opt_vers_4_2:
+               mnt->version = 4;
+               mnt->minorversion = 2;
+               break;
        default:
                return 0;
        }
index 7764aca1c6b73addff9366bebe2164d72db2c5e9..42046004a2f6ab70ac3f718f3f0d73ae8095f830 100644 (file)
@@ -399,11 +399,15 @@ enum lock_type4 {
 #define NFS4_VERSION 4
 #define NFS4_MINOR_VERSION 0
 
+#if defined(CONFIG_NFS_V4_2)
+#define NFS4_MAX_MINOR_VERSION 2
+#else
 #if defined(CONFIG_NFS_V4_1)
 #define NFS4_MAX_MINOR_VERSION 1
 #else
 #define NFS4_MAX_MINOR_VERSION 0
 #endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_NFS_V4_2 */
 
 #define NFS4_DEBUG 1