NFS: Use AF_INET6 NFSv4 callback listener only if IPv6 is built in
Subsystems (2)
PATCH 1/1 NFS: Use AF_INET6 NFSv4 callback listener only if IPv6 is built in
Apparently a lot of people need to disable IPv6 completely on their distributor-built systems, and they do this by blacklisting the ipv6.ko module. If CONFIG_IPV6_MODULE is set but the module can't be loaded, this causes the creation of the NFSv4 callback listener to fail.
As a workaround, change the callback service to use an AF_INET6 listener only if IPv6 is built into the kernel.
This allows IPv6 NFS testing to continue, while supporting legacy IPv4 NFS as before. In the meantime, we will pursue a long-term fix so that the callback server will be able to handle this case correctly.
---
Trond, here's what I'm thinking about for fixing the callback server piece of the "unloadable ipv6.ko" problem. Comments?
fs/nfs/callback.c | 10 ++++++---- fs/nfs/client.c | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-)
fs/nfs/callback.c +6 -4
@@ -43,13 +43,15 @@ static const int nfs_set_port_max = 65535;/* * If the kernel has IPv6 support available, always listen for -* both AF_INET and AF_INET6 requests. +* both AF_INET and AF_INET6 requests. To avoid breaking lockd +* if the ipv6 module was built but has been blacklisted, enable +* this only if IPv6 support is built into the kernel. */ -#if defined(CONFIG_IPV6 ) || defined(CONFIG_IPV6_MODULE ) +#if defined(CONFIG_IPV6 )static const sa_family_t nfs_callback_family =AF_INET6 ; -#else +#else /* CONFIG_IPV6 */ static const sa_family_t nfs_callback_family =AF_INET ; -#endif +#endif /* CONFIG_IPV6 */ static int param_set_port (const char *val,struct kernel_param *kp) {
fs/nfs/client.c +3 -3
@@ -223,7 +223,7 @@ void nfs_put_client(struct nfs_client *clp) } } -#if defined(CONFIG_IPV6 ) || defined(CONFIG_IPV6_MODULE ) +#ifdef CONFIG_IPV6 static const struct in6_addr *nfs_map_ipv4_addr (const struct sockaddr *sa,struct in6_addr *addr_mapped) {switch (sa->sa_family) {
@@ -255,7 +255,7 @@ static int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1, }return 0 ; } -#else +#else /* CONFIG_IPV6 */ static int nfs_sockaddr_match_ipaddr4 (const struct sockaddr_in *sa1,const struct sockaddr_in *sa2) {
@@ -270,7 +270,7 @@ static int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1,return nfs_sockaddr_match_ipaddr4 ((const struct sockaddr_in *)sa1, (const struct sockaddr_in *)sa2); } -#endif +#endif /* CONFIG_IPV6 */ /* * Find a client by IP address and protocol version
A message that is not in the archive (sent off-list or not yet received): 20090204164857.26771.31809.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org
Sorry, "fixing" is a bit too strong. I mean working around the issue until we have a long-term solution.
Quoted 84 lines · Chuck Lever
Apparently a lot of people need to disable IPv6 completely on their distributor-built systems, and they do this by blacklisting the ipv6.ko module. If
CONFIG_IPV6_MODULEis set but the module can't be loaded, this causes the creation of the NFSv4 callback listener to fail.As a workaround, change the callback service to use an
AF_INET6listener only if IPv6 is built into the kernel.This allows IPv6 NFS testing to continue, while supporting legacy IPv4 NFS as before. In the meantime, we will pursue a long-term fix so that the callback server will be able to handle this case correctly.
Signed-off-by Chuck Lever <[email protected]>---
Trond, here's what I'm thinking about for fixing the callback server piece of the "unloadable ipv6.ko" problem. Comments?
fs/nfs/callback.c| 10 ++++++----fs/nfs/client.c| 6 +++---2 files changed, 9 insertions(+), 7 deletions(-)fs/nfs/callback.c +6
-4@@ -43,13 +43,15 @@ static const int nfs_set_port_max = 65535;/* * If the kernel has IPv6 support available, always listen for -* both AF_INET and AF_INET6 requests. +* both AF_INET and AF_INET6 requests. To avoid breaking lockd +* if the ipv6 module was built but has been blacklisted, enable +* this only if IPv6 support is built into the kernel. */ -#if defined(CONFIG_IPV6 ) || defined(CONFIG_IPV6_MODULE ) +#if defined(CONFIG_IPV6 )static const sa_family_t nfs_callback_family =AF_INET6 ; -#else +#else /* CONFIG_IPV6 */ static const sa_family_t nfs_callback_family =AF_INET ; -#endif +#endif /* CONFIG_IPV6 */ static int param_set_port (const char *val,struct kernel_param *kp) {fs/nfs/client.c +2
-2@@ -223,7 +223,7 @@ void nfs_put_client(struct nfs_client *clp) } } -#if defined(CONFIG_IPV6 ) || defined(CONFIG_IPV6_MODULE ) +#ifdef CONFIG_IPV6 static const struct in6_addr *nfs_map_ipv4_addr (const struct sockaddr *sa,struct in6_addr *addr_mapped) {switch (sa->sa_family) {@@ -255,7 +255,7 @@ static int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1, }return 0 ; } -#else +#else /* CONFIG_IPV6 */ static int nfs_sockaddr_match_ipaddr4 (const struct sockaddr_in *sa1,const struct sockaddr_in *sa2){
fs/nfs/client.c +1
-1@@ -270,7 +270,7 @@ static int nfs_sockaddr_match_ipaddr(conststruct sockaddr *sa1, return nfs_sockaddr_match_ipaddr4((const struct sockaddr_in *)sa1, (const struct sockaddr_in *)sa2); } -#endif +#endif /* CONFIG_IPV6 */ /* * Find a client by IP address and protocol version
--
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
Signature · 2 lines
Chuck Lever chuck[dot]lever[at]oracle[dot]com
Quoted 2 lines · Chuck Lever
Sorry, "fixing" is a bit too strong. I mean working around the issue until we have a long-term solution.
This isn't an acceptable workaround, since it causes a regression for those people who do have IPv6 enabled as a module. i.e. me...
The real problem here is the existence of serv->sv_family, which basically means that we need to decide whether or not we want IPv6 functionality when we set up the server, instead of when we set up the transport. Why do we need this in the first place?
Trond
Quoted 92 lines · Chuck Lever
Quoted 90 lines
Apparently a lot of people need to disable IPv6 completely on their distributor-built systems, and they do this by blacklisting the ipv6.ko
module. IfCONFIG_IPV6_MODULEis set but the module can't be loaded, this causes the creation of the NFSv4 callback listener to fail.As a workaround, change the callback service to use an
AF_INET6listener
only if IPv6 is built into the kernel.This allows IPv6 NFS testing to continue, while supporting legacy IPv4 NFS as before. In the meantime, we will pursue a long-term fix so that
the callback server will be able to handle this case correctly.Signed-off-by Chuck Lever <[email protected]>---
Trond, here's what I'm thinking about for fixing the callback server piece of the "unloadable ipv6.ko" problem. Comments?
fs/nfs/callback.c| 10 ++++++----fs/nfs/client.c| 6 +++---2 files changed, 9 insertions(+), 7 deletions(-)fs/nfs/callback.c +6
-4@@ -43,13 +43,15 @@ static const int nfs_set_port_max = 65535;/* * If the kernel has IPv6 support available, always listen for -* both AF_INET and AF_INET6 requests. +* both AF_INET and AF_INET6 requests. To avoid breaking lockd +* if the ipv6 module was built but has been blacklisted, enable +* this only if IPv6 support is built into the kernel. */ -#if defined(CONFIG_IPV6 ) || defined(CONFIG_IPV6_MODULE ) +#if defined(CONFIG_IPV6 )static const sa_family_t nfs_callback_family =AF_INET6 ; -#else +#else /* CONFIG_IPV6 */ static const sa_family_t nfs_callback_family =AF_INET ; -#endif +#endif /* CONFIG_IPV6 */ static int param_set_port (const char *val,struct kernel_param *kp) {fs/nfs/client.c +1
-1@@ -223,7 +223,7 @@ void nfs_put_client(struct nfs_client *clp) } } -#if defined(CONFIG_IPV6 ) || defined(CONFIG_IPV6_MODULE ) +#ifdef CONFIG_IPV6 static const struct
in6_addr*nfs_map_ipv4_addr(const struct sockaddr *sa, structin6_addr*addr_mapped){ switch (sa->sa_family) {fs/nfs/client.c +1
-1@@ -255,7 +255,7 @@ static int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1, }return 0 ; } -#else +#else /* CONFIG_IPV6 */ static int nfs_sockaddr_match_ipaddr4 (const struct sockaddr_in *sa1,const struct sockaddr_in *sa2){
fs/nfs/client.c +1
-1@@ -270,7 +270,7 @@ static int nfs_sockaddr_match_ipaddr(conststruct sockaddr *sa1, return nfs_sockaddr_match_ipaddr4((const struct sockaddr_in *)sa1, (const struct sockaddr_in *)sa2); } -#endif +#endif /* CONFIG_IPV6 */ /* * Find a client by IP address and protocol version
--
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): 1233772405.7161.45.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org
Quoted 6 lines · Trond Myklebust
Quoted 2 lines · Chuck Lever
Sorry, "fixing" is a bit too strong. I mean working around the issue until we have a long-term solution.
This isn't an acceptable workaround, since it causes a regression for those people who do have IPv6 enabled as a module. i.e. me...
Don't you just get normal AF_INET callbacks in that case?
Is the problem that you are using an IPv6 mount address, and want to ensure your callback service and lockd are listening on AF_INET6? That dependency web is a problem, and for a workaround we can also disable IPv6 mounts if IPv6 support is built as a module.
Quoted 4 lines
The real problem here is the existence of
serv->sv_family, which basically means that we need to decide whether or not we want IPv6 functionality when we set up the server, instead of when we set up the transport. Why do we need this in the first place?
1. we don't want to create an AF_INET6 listener for kernel RPC services that can't yet support it (ie just NFSD at this point).
2. svc_create() handles rpcbind registration, so it needs to know whether to register both inet and inet6 netids or just inet. Maybe we should move the svc_register call to svc_create_xprt() ?
3. sock_create(AF_INET6) would pin ipv6.ko, but NFSD allows listener sockets to come and go. I would rather just pin ipv6.ko for the duration, and unpin it in svc_destroy. Again, svc_create_xprt might be a place to do that.
Quoted 95 lines
Trond
Quoted 92 lines · Chuck Lever
Quoted 90 lines
Apparently a lot of people need to disable IPv6 completely on their distributor-built systems, and they do this by blacklisting the ipv6.ko
module. IfCONFIG_IPV6_MODULEis set but the module can't be loaded, this causes the creation of the NFSv4 callback listener to fail.As a workaround, change the callback service to use an
AF_INET6listener
only if IPv6 is built into the kernel.This allows IPv6 NFS testing to continue, while supporting legacy IPv4 NFS as before. In the meantime, we will pursue a long-term fix so that
the callback server will be able to handle this case correctly.Signed-off-by Chuck Lever <[email protected]>---
Trond, here's what I'm thinking about for fixing the callback server piece of the "unloadable ipv6.ko" problem. Comments?
fs/nfs/callback.c| 10 ++++++----fs/nfs/client.c| 6 +++---2 files changed, 9 insertions(+), 7 deletions(-)fs/nfs/callback.c +6
-4@@ -43,13 +43,15 @@ static const int nfs_set_port_max = 65535;/* * If the kernel has IPv6 support available, always listen for -* both AF_INET and AF_INET6 requests. +* both AF_INET and AF_INET6 requests. To avoid breaking lockd +* if the ipv6 module was built but has been blacklisted, enable +* this only if IPv6 support is built into the kernel. */ -#if defined(CONFIG_IPV6 ) || defined(CONFIG_IPV6_MODULE ) +#if defined(CONFIG_IPV6 )static const sa_family_t nfs_callback_family =AF_INET6 ; -#else +#else /* CONFIG_IPV6 */ static const sa_family_t nfs_callback_family =AF_INET ; -#endif +#endif /* CONFIG_IPV6 */ static int param_set_port (const char *val,struct kernel_param *kp) {fs/nfs/client.c +1
-1@@ -223,7 +223,7 @@ void nfs_put_client(struct nfs_client *clp) } } -#if defined(CONFIG_IPV6 ) || defined(CONFIG_IPV6_MODULE ) +#ifdef CONFIG_IPV6 static const struct
in6_addr*nfs_map_ipv4_addr(const struct sockaddr *sa, structin6_addr*addr_mapped){ switch (sa->sa_family) {fs/nfs/client.c +1
-1@@ -255,7 +255,7 @@ static int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1, }return 0 ; } -#else +#else /* CONFIG_IPV6 */ static int nfs_sockaddr_match_ipaddr4 (const struct sockaddr_in *sa1,const struct sockaddr_in *sa2){
fs/nfs/client.c +1
-1@@ -270,7 +270,7 @@ static int nfs_sockaddr_match_ipaddr(conststruct sockaddr *sa1, return nfs_sockaddr_match_ipaddr4((const struct sockaddr_in *)sa1, (const struct sockaddr_in *)sa2); } -#endif +#endif /* CONFIG_IPV6 */ /* * Find a client by IP address and protocol version
--
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
Signature · 2 lines
Chuck Lever chuck[dot]lever[at]oracle[dot]com
Quoted 15 lines · Chuck Lever
Quoted 6 lines · Trond Myklebust
Quoted 2 lines · Chuck Lever
Sorry, "fixing" is a bit too strong. I mean working around the issue until we have a long-term solution.
This isn't an acceptable workaround, since it causes a regression for those people who do have IPv6 enabled as a module. i.e. me...
Don't you just get normal
AF_INETcallbacks in that case?Is the problem that you are using an IPv6 mount address, and want to ensure your callback service and lockd are listening on
AF_INET6? That dependency web is a problem, and for a workaround we can also disable IPv6 mounts if IPv6 support is built as a module.
Quoted 7 lines
Quoted 4 lines
The real problem here is the existence of
serv->sv_family, which basically means that we need to decide whether or not we want IPv6 functionality when we set up the server, instead of when we set up the transport. Why do we need this in the first place?1. we don't want to create an
AF_INET6listener for kernel RPC services that can't yet support it (ie just NFSD at this point).
I'm not advocating changing all sockets to AF_INET6. I'm advocating adding a socket family parameter to svc_create_xprt() so that IPv6-capable services like nfs_callback_up() can first try to set up service using AF_INET6 socket, then fall back to calling svc_create_xprt() again with AF_INET in case of ipv6 service failure.
Quoted 3 lines
2.
svc_create()handles rpcbind registration, so it needs to know whether to register both inet and inet6 netids or just inet. Maybe we should move thesvc_registercall tosvc_create_xprt()?
Where does svc_create() do rpcbind? AFAICS, svc_register is called by svc_setup_socket(), which again is called by svc_create_xprt(). You've got to set up the listening socket before you can register the service with rpcbind, so I can't see how it could be done any other way.
Quoted 4 lines
3.
sock_create(AF_INET6)would pin ipv6.ko, but NFSD allows listener sockets to come and go. I would rather just pin ipv6.ko for the duration, and unpin it insvc_destroy. Again,svc_create_xprtmight be a place to do that.
It's the obvious place, since that's what creates and destroys the socket.
Trond
A message that is not in the archive (sent off-list or not yet received): 1233776361.7161.67.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org
Quoted 21 lines · Trond Myklebust
Quoted 20 lines · Chuck Lever
Quoted 6 lines · Trond Myklebust
Quoted 2 lines · Chuck Lever
Sorry, "fixing" is a bit too strong. I mean working around the issue until we have a long-term solution.
This isn't an acceptable workaround, since it causes a regression for those people who do have IPv6 enabled as a module. i.e. me...
Don't you just get normal
AF_INETcallbacks in that case?Is the problem that you are using an IPv6 mount address, and want to ensure your callback service and lockd are listening on
AF_INET6? That dependency web is a problem, and for a workaround we can also disable IPv6 mounts if IPv6 support is built as a module.Quoted 4 lines
The real problem here is the existence of
serv->sv_family, which basically means that we need to decide whether or not we want IPv6 functionality when we set up the server, instead of when we set up the transport. Why do we need this in the first place?
Quoted 8 lines
Quoted 2 lines
1. we don't want to create an
AF_INET6listener for kernel RPC services that can't yet support it (ie just NFSD at this point).I'm not advocating changing all sockets to
AF_INET6. I'm advocating adding a socket family parameter tosvc_create_xprt()so that IPv6-capable services likenfs_callback_up()can first try to set up service usingAF_INET6socket, then fall back to callingsvc_create_xprt()again withAF_INETin case of ipv6 service failure.
I think we're on the same wavelength there, and we can get rid of the nfs_callback_family thingie.
Steve took a similar approach with lockd, but again, we have a web of dependencies that needs to be addressed. It may be enough that the client will balk at an IPv6 server in a mount request before we even get to the point of a lockd_up/nfs_callback_up.
Quoted 8 lines
Quoted 3 lines
2.
svc_create()handles rpcbind registration, so it needs to know whether to register both inet and inet6 netids or just inet. Maybe we should move thesvc_registercall tosvc_create_xprt()?Where does
svc_create()do rpcbind? AFAICS,svc_registeris called bysvc_setup_socket(), which again is called bysvc_create_xprt(). You've got to set up the listening socket before you can register the service with rpcbind, so I can't see how it could be done any other way.
Sorry, I misspoke.
svc_register is invoked with an sv_serv. Most of these socket setup functions have an sv_serv argument, so it seemed easier to add a field in sv_serv rather than another argument to a bunch of functions. There may be some other reason I did it this way, but I'm not remembering it right at the moment.
In any event, I can look at removing sv_family and using some other mechanism for identifying the address family of the listener.
Quoted 7 lines
Quoted 4 lines
3.
sock_create(AF_INET6)would pin ipv6.ko, but NFSD allows listener sockets to come and go. I would rather just pin ipv6.ko for the duration, and unpin it insvc_destroy. Again,svc_create_xprtmight be a place to do that.It's the obvious place, since that's what creates and destroys the socket.
I want to look at the lifetime of these transports to make sure we don't have gaps where ipv6.ko could be unloaded, with confusing consequences. Otherwise, this sounds fine.
--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com