sunrpc: split the vs_hidden flag into TCP and UDP variants
Subsystems (3)
PATCH 1/1 sunrpc: split the vs_hidden flag into TCP and UDP variants
RFC3530 states:
Where an NFS version 4 implementation supports operation over the IP network protocol, the supported transports between NFS and IP MUST be among the IETF-approved congestion control transport protocols, which include TCP and SCTP
The NFS server currently registers the NFSv4 UDP port with the portmapper, which it really shouldn't do. This patch splits the vs_hidden flag into TCP and UDP variants, and sets vs_hidden_udp for the NFSv4 service.
--- fs/nfs/callback_xdr.c | 3 ++- fs/nfsd/nfs2acl.c | 1 - fs/nfsd/nfs3acl.c | 1 - fs/nfsd/nfs4proc.c | 1 + include/linux/sunrpc/svc.h | 5 +++-- net/sunrpc/svc.c | 15 +++++++++++---- 6 files changed, 17 insertions(+), 9 deletions(-)
fs/nfs/callback_xdr.c +2 -1
@@ -783,7 +783,8 @@ struct svc_version nfs4_callback_version1 = { .vs_proc = nfs4_callback_procedures1, .vs_xdrsize = NFS4_CALLBACK_XDRSIZE, .vs_dispatch = NULL, - .vs_hidden = 1, + .vs_hidden_tcp = true, + .vs_hidden_udp = true, };struct svc_version nfs4_callback_version4 = {
fs/nfsd/nfs2acl.c +0 -1
@@ -352,5 +352,4 @@ struct svc_version nfsd_acl_version2 = { .vs_proc = nfsd_acl_procedures2, .vs_dispatch = nfsd_dispatch, .vs_xdrsize = NFS3_SVC_XDRSIZE, - .vs_hidden = 0, };
fs/nfsd/nfs3acl.c +0 -1
@@ -262,6 +262,5 @@ struct svc_version nfsd_acl_version3 = { .vs_proc = nfsd_acl_procedures3, .vs_dispatch = nfsd_dispatch, .vs_xdrsize = NFS3_SVC_XDRSIZE, - .vs_hidden = 0, };
fs/nfsd/nfs4proc.c +1 -0
@@ -1365,6 +1365,7 @@ struct svc_version nfsd_version4 = { .vs_proc = nfsd_procedures4, .vs_dispatch = nfsd_dispatch, .vs_xdrsize = NFS4_SVC_XDRSIZE, + .vs_hidden_udp = true, };/*
include/linux/sunrpc/svc.h +3 -2
@@ -370,8 +370,9 @@ struct svc_version {struct svc_procedure * vs_proc;/* per-procedure info */ u32 vs_xdrsize;/* xdrsize needed for this version */ - unsigned int vs_hidden : 1; /* Don't register with portmapper. -* Only used for nfsacl so far. */ +/* these flags control whether program is registered with rpcbind */ +bool vs_hidden_tcp; +bool vs_hidden_udp;/* Override dispatch function (e.g. when caching replies). * A return value of 0 means drop the request.
net/sunrpc/svc.c +11 -4
@@ -868,6 +868,7 @@ int svc_register(const struct svc_serv *serv, const int family,struct svc_program *progp;unsigned int i;int error =0 ; +bool vs_hidden;BUG_ON (proto ==0 && port ==0 );
@@ -876,16 +877,20 @@ int svc_register(const struct svc_serv *serv, const int family,if (progp->pg_vers[i] ==NULL )continue ; + vs_hidden = (proto ==IPPROTO_UDP ) ? + progp->pg_vers[i]->vs_hidden_udp : + progp->pg_vers[i]->vs_hidden_tcp; +dprintk ("svc: svc_register(%sv%d, %s, %u, %u)%s\n" , progp->pg_name, i, - proto ==IPPROTO_UDP ?"udp" :"tcp" , + proto ==IPPROTO_UDP ?"udp" :"tcp" , port, family, - progp->pg_vers[i]->vs_hidden? + vs_hidden ?" (but not telling portmap)" :"" ); -if (progp->pg_vers[i]->vs_hidden) +if (vs_hidden)continue ; error = __svc_register(progp->pg_name, progp->pg_prog,
@@ -943,7 +948,9 @@ static void svc_unregister(const struct svc_serv *serv)for (i =0 ; i < progp->pg_nvers; i++) {if (progp->pg_vers[i] ==NULL )continue ; -if (progp->pg_vers[i]->vs_hidden) + +if (progp->pg_vers[i]->vs_hidden_tcp && + progp->pg_vers[i]->vs_hidden_udp)continue ;__svc_unregister (progp->pg_prog, i, progp->pg_name);
Signature · 1 line
1.5.5.6
Does this mean that the Linux NFS server will no longer respond to NFSv4 requests coming in over UDP? If it will continue to do so, wouldn't it be more important to solve that correctly?
Thanx... ps
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jeff Layton
Sent: Thursday, June 24, 2010 9:34 PM
To: [email protected]
Cc: [email protected]
Subject: [PATCH] sunrpc: split the vs_hidden flag into TCP and UDP variants
RFC3530 states:
Where an NFS version 4 implementation supports operation over the IP network protocol, the supported transports between NFS and IP MUST be among the IETF-approved congestion control transport protocols, which include TCP and SCTP
The NFS server currently registers the NFSv4 UDP port with the portmapper, which it really shouldn't do. This patch splits the vs_hidden flag into TCP and UDP variants, and sets vs_hidden_udp for the NFSv4 service.
--- fs/nfs/callback_xdr.c | 3 ++- fs/nfsd/nfs2acl.c | 1 - fs/nfsd/nfs3acl.c | 1 - fs/nfsd/nfs4proc.c | 1 + include/linux/sunrpc/svc.h | 5 +++-- net/sunrpc/svc.c | 15 +++++++++++---- 6 files changed, 17 insertions(+), 9 deletions(-)
fs/nfs/callback_xdr.c +2 -1
@@ -783,7 +783,8 @@ struct svc_version nfs4_callback_version1 = { .vs_proc = nfs4_callback_procedures1, .vs_xdrsize = NFS4_CALLBACK_XDRSIZE, .vs_dispatch = NULL, - .vs_hidden = 1, + .vs_hidden_tcp = true, + .vs_hidden_udp = true, };struct svc_version nfs4_callback_version4 = {
fs/nfsd/nfs2acl.c +0 -1
@@ -352,5 +352,4 @@ struct svc_version nfsd_acl_version2 = { .vs_proc = nfsd_acl_procedures2, .vs_dispatch = nfsd_dispatch, .vs_xdrsize = NFS3_SVC_XDRSIZE, - .vs_hidden = 0, };
fs/nfsd/nfs3acl.c +0 -1
@@ -262,6 +262,5 @@ struct svc_version nfsd_acl_version3 = { .vs_proc = nfsd_acl_procedures3, .vs_dispatch = nfsd_dispatch, .vs_xdrsize = NFS3_SVC_XDRSIZE, - .vs_hidden = 0, };
fs/nfsd/nfs4proc.c +1 -0
@@ -1365,6 +1365,7 @@ struct svc_version nfsd_version4 = { .vs_proc = nfsd_procedures4, .vs_dispatch = nfsd_dispatch, .vs_xdrsize = NFS4_SVC_XDRSIZE, + .vs_hidden_udp = true, };/*
include/linux/sunrpc/svc.h +0 -0
@@ -370,8 +370,9 @@ struct svc_version {struct svc_procedure * vs_proc;/* per-procedure info */ u32 vs_xdrsize;/* xdrsize needed for
this version */
- unsigned int vs_hidden : 1; /* Don't register with
portmapper.
- * Only used for nfsacl
so far. */
+ /* these flags control whether program is registered with
rpcbind */
+ bool vs_hidden_tcp;
+ bool vs_hidden_udp;
/* Override dispatch function (e.g. when caching replies).
* A return value of 0 means drop the request.
net/sunrpc/svc.c +0 -0
@@ -868,6 +868,7 @@ int svc_register(const struct svc_serv *serv, const
int family,
struct svc_program *progp;
unsigned int i;
int error = 0;
+ bool vs_hidden;
BUG_ON(proto == 0 && port == 0);
@@ -876,16 +877,20 @@ int svc_register(const struct svc_serv *serv, const int family,
if (progp->pg_vers[i] == NULL)
continue;
+ vs_hidden = (proto == IPPROTO_UDP) ?
+ progp->pg_vers[i]->vs_hidden_udp :
+ progp->pg_vers[i]->vs_hidden_tcp;
+
dprintk("svc: svc_register(%sv%d, %s, %u,
%u)%s\n",
progp->pg_name, i,
- proto == IPPROTO_UDP? "udp" :
"tcp",
+ proto == IPPROTO_UDP ? "udp" :
"tcp",
port,
family,
- progp->pg_vers[i]->vs_hidden?
+ vs_hidden ?
" (but not telling
portmap)" : "");
- if (progp->pg_vers[i]->vs_hidden)
+ if (vs_hidden)
continue;
error = __svc_register(progp->pg_name,progp->pg_prog,
@@ -943,7 +948,9 @@ static void svc_unregister(const struct svc_serv *serv)
for (i = 0; i < progp->pg_nvers; i++) {
if (progp->pg_vers[i] == NULL)
continue;
- if (progp->pg_vers[i]->vs_hidden)
+
+ if (progp->pg_vers[i]->vs_hidden_tcp &&
+ progp->pg_vers[i]->vs_hidden_udp)
continue;
__svc_unregister(progp->pg_prog, i,progp->pg_name);
Signature · 6 lines
1.5.5.6 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): BF3BB6D12298F54B89C8DCC1E4073D800183CAB2-1Zg0zMUlrbd9m/[email protected]
Quoted 3 lines · On Fri, 2010-06-25 at 08:58 -0400, [email protected] wrote:
Does this mean that the Linux NFS server will no longer respond to NFSv4 requests coming in over UDP? If it will continue to do so, wouldn't it be more important to solve that correctly?
Agreed. Either we keep UDP support on the server and advertise it too, or we should throw it out altogether...
Cheers
Trond
A message that is not in the archive (sent off-list or not yet received): 1277471650.2881.6.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org
Quoted 8 lines · On Fri, 25 Jun 2010 09:14:10 -0400 Trond Myklebust…
Quoted 3 lines · On Fri, 2010-06-25 at 08:58 -0400, [email protected] wrote:
Does this mean that the Linux NFS server will no longer respond to NFSv4 requests coming in over UDP? If it will continue to do so, wouldn't it be more important to solve that correctly?
Agreed. Either we keep UDP support on the server and advertise it too, or we should throw it out altogether...
Ok, I'll start working on it. A question though...
When we get a NFSv4 request over UDP, what's the correct response? A PROG_MISMATCH RPC error?
Signature · 1 line
Jeff Layton <[email protected]>
A message that is not in the archive (sent off-list or not yet received): 20100625103503.011ae577-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org
Quoted 8 lines · Jeff Layton
Quoted 5 lines · On Fri, 25 Jun 2010 09:14:10 -0400 Trond Myklebust…
Quoted 3 lines · On Fri, 2010-06-25 at 08:58 -0400, [email protected] wrote:
Does this mean that the Linux NFS server will no longer respond to NFSv4 requests coming in over UDP? If it will continue to do so, wouldn't it be more important to solve that correctly?
Quoted 9 lines
Quoted 3 lines
Agreed. Either we keep UDP support on the server and advertise it too, or we should throw it out altogether...
Ok, I'll start working on it. A question though...
When we get a NFSv4 request over UDP, what's the correct response? A
PROG_MISMATCHRPC error?
Yes. A PROG_MISMATCH would be appropriate for that case.
Cheers
Trond
Quoted 8 lines · On Fri, 25 Jun 2010 08:58:12 -0400 <[email protected]> wrote:
Does this mean that the Linux NFS server will no longer respond to NFSv4 requests coming in over UDP? If it will continue to do so, wouldn't it be more important to solve that correctly?
Thanx... ps
I think that would be a good thing to do too, but that's a bit more invasive. The RPC layer doesn't really have infrastructure at the moment to say "don't service requests for this protocol version on this transport". I'd eventually like to see that happen, and I'm willing to work on it as well, but I think having the kernel not advertise v4 over UDP is a reasonable first step.
The other piece of this (that I believe steved is working on) is to make mount.nfs not attempt to do v4 over UDP either. I'm not certain of how he's planning to implement it, but it seems reasonable that we can just make it skip to v3 when someone specifies "proto=udp" and doesn't specify a version explicitly.
Quoted 156 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jeff Layton
Sent: Thursday, June 24, 2010 9:34 PM
To: [email protected]
Cc: [email protected]
Subject: [PATCH] sunrpc: split thevs_hiddenflag into TCP and UDP variantsRFC3530 states:
Where an NFS version 4 implementation supports operation over the IP network protocol, the supported transports between NFS and IP MUST be among the IETF-approved congestion control transport protocols, which include TCP and SCTP
The NFS server currently registers the NFSv4 UDP port with the portmapper, which it really shouldn't do. This patch splits the
vs_hiddenflag into TCP and UDP variants, and setsvs_hidden_udpfor the NFSv4 service.Reported-by Sachin Prabhu <[email protected]>Signed-off-by Jeff Layton <[email protected]>--- fs/nfs/callback_xdr.c | 3 ++- fs/nfsd/nfs2acl.c | 1 - fs/nfsd/nfs3acl.c | 1 - fs/nfsd/nfs4proc.c | 1 + include/linux/sunrpc/svc.h | 5 +++-- net/sunrpc/svc.c | 15 +++++++++++---- 6 files changed, 17 insertions(+), 9 deletions(-)fs/nfs/callback_xdr.c +2
-1@@ -783,7 +783,8 @@ struct svc_version nfs4_callback_version1 = { .vs_proc = nfs4_callback_procedures1, .vs_xdrsize = NFS4_CALLBACK_XDRSIZE, .vs_dispatch = NULL, - .vs_hidden = 1, + .vs_hidden_tcp = true, + .vs_hidden_udp = true, };struct svc_version nfs4_callback_version4 = {fs/nfsd/nfs2acl.c +0
-1@@ -352,5 +352,4 @@ struct svc_version nfsd_acl_version2 = { .vs_proc = nfsd_acl_procedures2, .vs_dispatch = nfsd_dispatch, .vs_xdrsize = NFS3_SVC_XDRSIZE, - .vs_hidden = 0, };fs/nfsd/nfs3acl.c +0
-1@@ -262,6 +262,5 @@ struct svc_version nfsd_acl_version3 = { .vs_proc = nfsd_acl_procedures3, .vs_dispatch = nfsd_dispatch, .vs_xdrsize = NFS3_SVC_XDRSIZE, - .vs_hidden = 0, };fs/nfsd/nfs4proc.c +1
-0@@ -1365,6 +1365,7 @@ struct svc_version nfsd_version4 = { .vs_proc = nfsd_procedures4, .vs_dispatch = nfsd_dispatch, .vs_xdrsize = NFS4_SVC_XDRSIZE, + .vs_hidden_udp = true, };/* include/linux/sunrpc/svc.h +0
-0@@ -370,8 +370,9 @@ struct svc_version {struct svc_procedure * vs_proc;/* per-procedure info */ u32 vs_xdrsize;/* xdrsize needed for this version */
include/linux/sunrpc/svc.h +0
-1- unsigned int vs_hidden : 1; /* Don't register withportmapper.
include/linux/sunrpc/svc.h +0
-1-* Only used for nfsacl so far. */
include/linux/sunrpc/svc.h +1
-0+/* these flags control whether program is registered with rpcbind */
include/linux/sunrpc/svc.h +2
-0+bool vs_hidden_tcp; +bool vs_hidden_udp;/* Override dispatch function (e.g. when caching replies). * A return value of 0 means drop the request. net/sunrpc/svc.c +8
-3@@ -868,6 +868,7 @@ int svc_register(const struct svc_serv *serv, constint family, struct svc_program *progp;unsigned int i;int error =0 ; +bool vs_hidden;BUG_ON (proto ==0 && port ==0 );@@ -876,16 +877,20 @@ int svc_register(const struct svc_serv *serv,const int family, if (progp->pg_vers[i] == NULL) continue; + vs_hidden = (proto ==IPPROTO_UDP ) ? + progp->pg_vers[i]->vs_hidden_udp : + progp->pg_vers[i]->vs_hidden_tcp; + dprintk("svc: svc_register(%sv%d, %s, %u, %u)%s\n", progp->pg_name, i, - proto ==IPPROTO_UDP ?"udp" :"tcp" , + proto ==IPPROTO_UDP ?"udp" :"tcp" , port, family, - progp->pg_vers[i]->vs_hidden? + vs_hidden ?" (but not telling portmap)" : ""); -if (progp->pg_vers[i]->vs_hidden) +if (vs_hidden)continue ; error = __svc_register(progp->pg_name,
progp->pg_prog,net/sunrpc/svc.c +3
-1@@ -943,7 +948,9 @@ static void svc_unregister(const struct svc_serv *serv)for (i =0 ; i < progp->pg_nvers; i++) {if (progp->pg_vers[i] ==NULL )continue ; -if (progp->pg_vers[i]->vs_hidden) + +if (progp->pg_vers[i]->vs_hidden_tcp && + progp->pg_vers[i]->vs_hidden_udp)continue ;__svc_unregister(progp->pg_prog, i,
progp->pg_name);
Signature · 1 line
Jeff Layton <[email protected]>