Note the position in the version array doesn't have to match the actual
rpc version number.
Signed-off-by: J. Bruce Fields <[email protected]>
---
fs/nfsd/nfs4callback.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 77bc9d3..b91bdee 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -430,7 +430,6 @@ static struct rpc_version nfs_cb_version4 = {
};
static struct rpc_version * nfs_cb_version[] = {
- NULL,
&nfs_cb_version4,
};
@@ -471,7 +470,7 @@ int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *cb)
.timeout = &timeparms,
.program = &cb_program,
.prognumber = cb->cb_prog,
- .version = nfs_cb_version[1]->number,
+ .version = 1,
.authflavor = clp->cl_flavor,
.flags = (RPC_CLNT_CREATE_NOPING | RPC_CLNT_CREATE_QUIET),
.client_name = clp->cl_principal,
--
1.7.0.4
On Fri, May 14, 2010 at 06:45:23PM -0400, J. Bruce Fields wrote:
> The 4.1 rfc actually specifices that the callback program must have
> version 4.
>
> As far as I can tell, this was unspecified in rfc 3530. But it looks to
> me like the NFSv4 client only ever accepted version 1!
>
> Newer linux clients allow either 1 or 4, for either minor version.
>
> So, the safest approach seems to be to use version 1 for 4.0 clients,
> and version 4 for 4.1 clients.
OK, following further discussion on the ietf list, let's stick to
version 1 for now and just add a comment.
--b.
commit b7299f44394336f51b526247a870d47d28f4f97c
Author: J. Bruce Fields <[email protected]>
Date: Fri May 14 17:57:35 2010 -0400
nfs4: minor callback code simplification, comment
Note the position in the version array doesn't have to match the actual
rpc version number--to me it seems clearer to maintain the distinction.
Also document choice of rpc callback version number, as discussed in
e.g. http://www.ietf.org/mail-archive/web/nfsv4/current/msg07985.html
and followups.
Signed-off-by: J. Bruce Fields <[email protected]>
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 77bc9d3..eb78e7e 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -424,13 +424,19 @@ static struct rpc_procinfo nfs4_cb_procedures[] = {
};
static struct rpc_version nfs_cb_version4 = {
+/*
+ * Note on the callback rpc program version number: despite language in rfc
+ * 5661 section 18.36.3 requiring servers to use 4 in this field, the
+ * official xdr descriptions for both 4.0 and 4.1 specify version 1, and
+ * in practice that appears to be what implementations use. The section
+ * 18.36.3 language is expected to be fixed in an erratum.
+ */
.number = 1,
.nrprocs = ARRAY_SIZE(nfs4_cb_procedures),
.procs = nfs4_cb_procedures
};
static struct rpc_version * nfs_cb_version[] = {
- NULL,
&nfs_cb_version4,
};
@@ -471,7 +477,7 @@ int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *cb)
.timeout = &timeparms,
.program = &cb_program,
.prognumber = cb->cb_prog,
- .version = nfs_cb_version[1]->number,
+ .version = 0,
.authflavor = clp->cl_flavor,
.flags = (RPC_CLNT_CREATE_NOPING | RPC_CLNT_CREATE_QUIET),
.client_name = clp->cl_principal,
The 4.1 rfc actually specifices that the callback program must have
version 4.
As far as I can tell, this was unspecified in rfc 3530. But it looks to
me like the NFSv4 client only ever accepted version 1!
Newer linux clients allow either 1 or 4, for either minor version.
So, the safest approach seems to be to use version 1 for 4.0 clients,
and version 4 for 4.1 clients.
Signed-off-by: J. Bruce Fields <[email protected]>
---
fs/nfsd/nfs4callback.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index b91bdee..bf79031 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -423,13 +423,29 @@ static struct rpc_procinfo nfs4_cb_procedures[] = {
PROC(CB_RECALL, COMPOUND, enc_cb_recall, dec_cb_recall),
};
-static struct rpc_version nfs_cb_version4 = {
+/*
+ * RFC 5661 section 18.36.3 (in the description of csa_cb_program),
+ * requires the callback rpc program version number to be 4. RFC 3530
+ * leaves this unspecified, however, pre-2.6.33 Linux NFSv4 clients
+ * required the version number to be 1.
+ * Therefore, the safest seems to be use version 1 for 4.0 clients and
+ * version 4 for 4.1 clients. Therefore, we define both versions:
+ */
+
+static struct rpc_version nfs_cb_version1 = {
.number = 1,
.nrprocs = ARRAY_SIZE(nfs4_cb_procedures),
.procs = nfs4_cb_procedures
};
+static struct rpc_version nfs_cb_version4 = {
+ .number = 4,
+ .nrprocs = ARRAY_SIZE(nfs4_cb_procedures),
+ .procs = nfs4_cb_procedures
+};
+
static struct rpc_version * nfs_cb_version[] = {
+ &nfs_cb_version1,
&nfs_cb_version4,
};
@@ -470,7 +486,8 @@ int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *cb)
.timeout = &timeparms,
.program = &cb_program,
.prognumber = cb->cb_prog,
- .version = 1,
+ /* See the comment before the nfs_cb_version1 definition: */
+ .version = cb->cb_minorversion ? 1 : 0,
.authflavor = clp->cl_flavor,
.flags = (RPC_CLNT_CREATE_NOPING | RPC_CLNT_CREATE_QUIET),
.client_name = clp->cl_principal,
--
1.7.0.4