Skip to contentSkip to conversation

Address kernel bugzilla 12256

PATCH In review Chuck Lever 3 participants 25 messages Jan 30, 2009 – Feb 27, 2009 6 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Address kernel bugzilla 12256

Hi Bruce-

Updated patch series to remove the SUNRPC_REGISTER_V4 kernel build option. These address kernel bugzilla 12256 ("RPC: failed to contact local rpcbind server (errno 5)." if CONFIG_SUNRPC_REGISTER_V4 is set to Y"). Please include them in your for-2.6.30 branch, replacing any previous version of this patch series.

There may be some problems applying this patch set to linux-next, as that may have recent patches that split up fs/Kconfig.

Steve Dickson also reports this related problem:

------ cut here ------

On a 2.6.29 kernel that has IPv6 turned off by

1) adding 'blacklist ipv6' to /etc/modprobe.d/blacklist
2) Adding NETWORKING_IPV6=no to /etc/sysconfig/network (note: not clear how much of this is effective since it's unknown if Network Manager even looks at this stuff)

When an ordinary v3 mount is tried:

mount -v server:/music /mnt/music

It fails in the following way:

mount.nfs: timeout set for Fri Jan 23 07:22:16 2009 mount.nfs: text-based options: 'addr=10.16.43.237' mount.nfs: mount(2): Address family not supported by protocol mount.nfs: Address family not supported by protocol

With the following being logged to /var/log/messages:

Jan 23 07:20:16 localhost kernel: RPC: failed to contact local rpcbind

server (errno 5).

------ cut here ------

When CONFIG_SUNRPC_REGISTER_V4 is removed, this exposes a second problem, addressed by "lockd: Use AF_INET6 listener only when IPv6 support is built in." It turns out that some Linux networking infrastructure simply doesn't support IPv6, so it is a popular workaround to blacklist the ipv6 module in a distribution-built kernel.

Unfortunately, if the module is blacklisted but was built during the kernel build, lockd still attempts to create an AF_INET6 listener, even for IPv4 mounts, and fails.

For now, we'll work around the problem by changing lockd to create AF_INET6 listeners only if IPv6 support is built into the kernel, and pursue a long-term fix in the mean time.

---

Chuck Lever (7):
SUNRPC: Remove CONFIG_SUNRPC_REGISTER_V4
SUNRPC: rpcb_register() should handle errors silently
SUNRPC: Simplify kernel RPC service registration
SUNRPC: Simplify svc_unregister()
SUNRPC: Don't return EPROTONOSUPPORT in svc_register()'s helpers
SUNRPC: Use IPv4 loopback for registering AF_INET6 kernel RPC services
lockd: Use AF_INET6 listener only when IPv6 support is built in

 fs/lockd/svc.c         |   11 +++--
 net/sunrpc/Kconfig     |   22 ----------
 net/sunrpc/rpcb_clnt.c |   25 +++---------
 net/sunrpc/svc.c       |  102 +++++++++++++++++++++---------------------------
 4 files changed, 58 insertions(+), 102 deletions(-)
Signature · 1 line
Chuck Lever

A message that is not in the archive (sent off-list or not yet received): 20090130200021.22301.22618.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org

#2 lore raw

PATCH 1/7 lockd: Use AF_INET6 listener only when IPv6 support is built in

Apparently a lot of people need to completely disable IPv6 on their distribution-built systems, and they do this by blacklisting the ipv6 module. This causes lockd_up(), and thus NFS mounts, to fail in all cases (even for IPv4 mounts) if CONFIG_IPV6_MODULE and CONFIG_SUNRPC_REGISTER_V4 is set.

As a workaround, change lockd 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 lockd (and eventually NFSD) will be able to handle this case correctly.

---

 fs/lockd/svc.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
fs/lockd/svc.c +6 -5
index 64f1c31..39ec7f2 100644
@@ -54,14 +54,15 @@ unsigned long			nlmsvc_timeout;
 
 /*
  * 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)) && \
-	defined(CONFIG_SUNRPC_REGISTER_V4)
+#if defined(CONFIG_IPV6) && defined(CONFIG_SUNRPC_REGISTER_V4)
 static const sa_family_t	nlmsvc_family = AF_INET6;
-#else	/* (CONFIG_IPV6 || CONFIG_IPV6_MODULE) && CONFIG_SUNRPC_REGISTER_V4 */
+#else	/* CONFIG_IPV6 && CONFIG_SUNRPC_REGISTER_V4 */
 static const sa_family_t	nlmsvc_family = AF_INET;
-#endif	/* (CONFIG_IPV6 || CONFIG_IPV6_MODULE) && CONFIG_SUNRPC_REGISTER_V4 */
+#endif	/* CONFIG_IPV6 && CONFIG_SUNRPC_REGISTER_V4 */
 
 /*
  * These can be set at insmod time (useful for NFS as root filesystem),

A message that is not in the archive (sent off-list or not yet received): 20090130201041.22301.60941.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org

#4 lore raw

Re: [PATCH 1/7] lockd: Use AF_INET6 listener only when IPv6 support is built in

Quoted 35 lines · Chuck Lever

Apparently a lot of people need to completely disable IPv6 on their distribution-built systems, and they do this by blacklisting the ipv6 module. This causes lockd_up(), and thus NFS mounts, to fail in all cases (even for IPv4 mounts) if CONFIG_IPV6_MODULE and CONFIG_SUNRPC_REGISTER_V4 is set.

As a workaround, change lockd 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 lockd (and eventually NFSD) will be able to handle this case correctly.

---

 fs/lockd/svc.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
fs/lockd/svc.c +3 -3
index 64f1c31..39ec7f2 100644
@@ -54,14 +54,15 @@ unsigned long			nlmsvc_timeout;
 
 /*
  * 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)) && \
-	defined(CONFIG_SUNRPC_REGISTER_V4)

fs/lockd/svc.c unsigned long nlmsvc_timeout; · line 68

Quoted 10 lines
fs/lockd/svc.c +3 -2
+#if defined(CONFIG_IPV6) && defined(CONFIG_SUNRPC_REGISTER_V4)
 static const sa_family_t	nlmsvc_family = AF_INET6;
-#else	/* (CONFIG_IPV6 || CONFIG_IPV6_MODULE) && CONFIG_SUNRPC_REGISTER_V4 */
+#else	/* CONFIG_IPV6 && CONFIG_SUNRPC_REGISTER_V4 */
 static const sa_family_t	nlmsvc_family = AF_INET;
-#endif	/* (CONFIG_IPV6 || CONFIG_IPV6_MODULE) && CONFIG_SUNRPC_REGISTER_V4 */
+#endif	/* CONFIG_IPV6 && CONFIG_SUNRPC_REGISTER_V4 */
 
 /*
  * These can be set at insmod time (useful for NFS as root filesystem),

That issue will affect the NFSv4 callback server too.

How about using something like a 'symbol_request(ipv6_getsockopt)' to probe whether or not IPv6 is available.

Trond

A message that is not in the archive (sent off-list or not yet received): 1233347546.9741.31.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org

#6 lore raw

Re: [PATCH 1/7] lockd: Use AF_INET6 listener only when IPv6 support is built in

Quoted 46 lines · Trond Myklebust
Quoted 45 lines · Chuck Lever

Apparently a lot of people need to completely disable IPv6 on their distribution-built systems, and they do this by blacklisting the ipv6 module. This causes lockd_up(), and thus NFS mounts, to fail in all cases (even for IPv4 mounts) if CONFIG_IPV6_MODULE and CONFIG_SUNRPC_REGISTER_V4 is set.

As a workaround, change lockd 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 lockd (and eventually NFSD) will be able to handle this case correctly.

---

fs/lockd/svc.c | 11 ++++++-----

1 files changed, 6 insertions(+), 5 deletions(-)
fs/lockd/svc.c +4 -4
index 64f1c31..39ec7f2 100644
@@ -54,14 +54,15 @@ unsigned long			nlmsvc_timeout;
 
 /*
 * 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)) && \
-	defined(CONFIG_SUNRPC_REGISTER_V4)
+#if defined(CONFIG_IPV6) && defined(CONFIG_SUNRPC_REGISTER_V4)
 static const sa_family_t	nlmsvc_family = AF_INET6;
-#else	/* (CONFIG_IPV6 || CONFIG_IPV6_MODULE) &&  

CONFIG_SUNRPC_REGISTER_V4 */
+#else /* CONFIG_IPV6 && CONFIG_SUNRPC_REGISTER_V4 */
static const sa_family_t nlmsvc_family = AF_INET;
-#endif /* (CONFIG_IPV6 || CONFIG_IPV6_MODULE) &&
CONFIG_SUNRPC_REGISTER_V4 */
+#endif /* CONFIG_IPV6 && CONFIG_SUNRPC_REGISTER_V4 */

Quoted 5 lines
Quoted 3 lines

/*
* These can be set at insmod time (useful for NFS as root
filesystem),

That issue will affect the NFSv4 callback server too.

I'll submit a separate patch for that.

Quoted 2 lines

How about using something like a 'symbol_request(ipv6_getsockopt)' to probe whether or not IPv6 is available.

That's a good idea. I was about to go looking for the right way to check if the module is available.

I've been discussing this with Steve. He'd like some way for lockd to recover if only an IPv4 mount is requested, but the logic to do this (and to report real errors on IPv6 mounts, and to handle the NFSD cases) might get complicated. Plus, once we start lockd with an AF_INET listener, we are stuck with IPv4-only until lockd is restarted from scratch.

I think we want any issues in this area to be handled at mount/export time, and not specifically by lockd or the callback server. What do you think?

Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
#7 lore raw

Re: [PATCH 1/7] lockd: Use AF_INET6 listener only when IPv6 support is built in

Quoted 6 lines · Chuck Lever
Quoted 2 lines · Trond Myklebust

How about using something like a 'symbol_request(ipv6_getsockopt)' to probe whether or not IPv6 is available.

That's a good idea. I was about to go looking for the right way to check if the module is available.

Note that this isn't really sufficient to prevent races. Somebody may remove the ipv6 module before we get so far as to setting up the sockets.

Quoted 10 lines

I've been discussing this with Steve. He'd like some way for lockd to recover if only an IPv4 mount is requested, but the logic to do this (and to report real errors on IPv6 mounts, and to handle the NFSD cases) might get complicated. Plus, once we start lockd with an AF_INET listener, we are stuck with IPv4-only until lockd is restarted from scratch.

I think we want any issues in this area to be handled at mount/export time, and not specifically by lockd or the callback server. What do you think?

Yes and no. I thought the motivation for doing what you currently do was to avoid mixing AF_INET and AF_INET6 sockets, since the latter listen on both IPv4 (via the IPv4 mapping) and IPv6? If so, it sounds to me as if we _must_ have lockd and the callback server set up IPv6 sockets whenever they are available.

Cheers
Trond

A message that is not in the archive (sent off-list or not yet received): 1233350290.9741.42.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org

#9 lore raw

Re: [PATCH 1/7] lockd: Use AF_INET6 listener only when IPv6 support is built in

Quoted 11 lines · Trond Myklebust
Quoted 6 lines · Chuck Lever
Quoted 2 lines · Trond Myklebust

How about using something like a 'symbol_request(ipv6_getsockopt)' to probe whether or not IPv6 is available.

That's a good idea. I was about to go looking for the right way to check if the module is available.

Note that this isn't really sufficient to prevent races. Somebody may remove the ipv6 module before we get so far as to setting up the sockets.

Right, I'm wondering if we need to use something heavyweight like try_module_get() here.

Quoted 7 lines
Quoted 7 lines

I've been discussing this with Steve. He'd like some way for lockd to recover if only an IPv4 mount is requested, but the logic to do this (and to report real errors on IPv6 mounts, and to handle the NFSD cases) might get complicated. Plus, once we start lockd with an AF_INET listener, we are stuck with IPv4-only until lockd is restarted from scratch.

Quoted 7 lines
Quoted 3 lines

I think we want any issues in this area to be handled at mount/export time, and not specifically by lockd or the callback server. What do you think?

Yes and no. I thought the motivation for doing what you currently do was to avoid mixing AF_INET and AF_INET6 sockets, since the latter listen on both IPv4 (via the IPv4 mapping) and IPv6?

AF_INET6 listeners can receive AF_INET packets too, but don't have to. My motivation was to use a single listener so we don't have to support multiple family listeners for each transport protocol in the server-side code. Also, having a separate IPv6-only listener means that someone can come along and hijack the IPv4 packets on that port.

It's just less of a headache with one listener.

Quoted 3 lines

If so, it sounds to me as if
we _must_ have lockd and the callback server set up IPv6 sockets whenever they are available.

That's what the code does now. The problem is exactly what does "whenever they are available" mean?

Are you suggesting we shouldn't ever fall back to AF_INET? (I'm OK with that answer, but would like a discussion). This means that if I try an IPv4 mount on a system built with an IPv6 module, but the module is unloadable, all mounts (even IPv4) fail outright. Apparently a lot of folks blacklist their IPv6 modules.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#10 lore raw

Re: [PATCH 1/7] lockd: Use AF_INET6 listener only when IPv6 support is built in

Quoted 5 lines · Chuck Lever
Quoted 3 lines · Trond Myklebust

If so, it sounds to me as if
we _must_ have lockd and the callback server set up IPv6 sockets whenever they are available.

Quoted 8 lines

That's what the code does now. The problem is exactly what does "whenever they are available" mean?

Are you suggesting we shouldn't ever fall back to AF_INET? (I'm OK with that answer, but would like a discussion). This means that if I try an IPv4 mount on a system built with an IPv6 module, but the module is unloadable, all mounts (even IPv4) fail outright. Apparently a lot of folks blacklist their IPv6 modules.

It sounds reasonable to me for now to take "whenever they are available" to mean "whenever ipv6 can be loaded", and to fall back on ipv4 only in that case. I guess the sort of case that would handle badly would be:

do an ipv4 mount
- try to find ipv6, fail, start lockd up ipv4-only
do an ipv6 mount
- no ipv6 support, so mount fails.
insmod ipv6
retry the ipv6 mount
- oops, too late to make lockd listen on ipv6. Fail this too.

But it'd still be an improvement.

For the future:

Quoted 4 lines

AF_INET6 listeners can receive AF_INET packets too, but don't have to. My motivation was to use a single listener so we don't have to support multiple family listeners for each transport protocol in the server-side code.

How hard would that be exactly?

Quoted 2 lines

Also, having a separate IPv6-only listener means that someone can come along and hijack the IPv4 packets on that port.

Starting listeners on both as early as possible reduces but doesn't eliminate the chance of that happening. Don't we just have to assume users of low port numbers are well-behaved to some degree?

--b.

#11 lore raw

Re: [PATCH 1/7] lockd: Use AF_INET6 listener only when IPv6 support is built in

Quoted 19 lines · J. Bruce Fields
Quoted 5 lines · Chuck Lever
Quoted 3 lines · Trond Myklebust

If so, it sounds to me as if
we _must_ have lockd and the callback server set up IPv6 sockets whenever they are available.

Quoted 8 lines

That's what the code does now. The problem is exactly what does "whenever they are available" mean?

Are you suggesting we shouldn't ever fall back to AF_INET? (I'm OK with that answer, but would like a discussion). This means that if I try an IPv4 mount on a system built with an IPv6 module, but the module is unloadable, all mounts (even IPv4) fail outright. Apparently a lot of folks blacklist their IPv6 modules.

It sounds reasonable to me for now to take "whenever they are available" to mean "whenever ipv6 can be loaded", and to fall back on ipv4 only in that case. I guess the sort of case that would handle badly would be:

Quoted 8 lines

do an ipv4 mount
- try to find ipv6, fail, start lockd up ipv4-only
do an ipv6 mount
- no ipv6 support, so mount fails.
insmod ipv6
retry the ipv6 mount
- oops, too late to make lockd listen on ipv6. Fail this too.

Yes, this is the case I'm concerned about. Also, given the twisty little maze of passages, all alike, that the nfsctl interface is, I wonder how we'll deal in the NFSD case.

Quoted 12 lines

But it'd still be an improvement.

For the future:

Quoted 4 lines

AF_INET6 listeners can receive AF_INET packets too, but don't have to. My motivation was to use a single listener so we don't have to support multiple family listeners for each transport protocol in the server-side code.

How hard would that be exactly?

Quoted 6 lines
Quoted 2 lines

Also, having a separate IPv6-only listener means that someone can come along and hijack the IPv4 packets on that port.

Starting listeners on both as early as possible reduces but doesn't eliminate the chance of that happening. Don't we just have to assume users of low port numbers are well-behaved to some degree?

We have one listener now, so it doesn't ever happen.

Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
#12 lore raw

Re: [PATCH 1/7] lockd: Use AF_INET6 listener only when IPv6 support is built in

Quoted 10 lines · Chuck Lever
Quoted 7 lines · J. Bruce Fields
Quoted 2 lines · Chuck Lever

Also, having a separate IPv6-only listener means that someone can come along and hijack the IPv4 packets on that port.

Starting listeners on both as early as possible reduces but doesn't eliminate the chance of that happening. Don't we just have to assume users of low port numbers are well-behaved to some degree?

We have one listener now, so it doesn't ever happen.

If you restart nfsd, or if other programs are running during boot, then it can still happen. Right?

--b.

#13 lore raw

Re: [PATCH 1/7] lockd: Use AF_INET6 listener only when IPv6 support is built in

Quoted 6 lines · J. Bruce Fields
Quoted 5 lines · Chuck Lever
Quoted 4 lines · J. Bruce Fields
Quoted 2 lines · Chuck Lever

Also, having a separate IPv6-only listener means that someone can come along and hijack the IPv4 packets on that port.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Starting listeners on both as early as possible reduces but doesn't eliminate the chance of that happening. Don't we just have to assume users of low port numbers are well-behaved to some degree?

We have one listener now, so it doesn't ever happen.

If you restart nfsd, or if other programs are running during boot, then it can still happen. Right?

Yes, but that can also happen for IPv4 sockets.

I'm talking about while the listener is up and running. In this case, it's more of a IPv4 to IPv6 transition issue, not a security thing. If the traffic is hijacked then your service starts behaving in ways you don't expect and are hard to pin down.

Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
#14 lore raw

Re: [PATCH 1/7] lockd: Use AF_INET6 listener only when IPv6 support is built in

In reply to Chuck Lever
Quoted 7 lines · Chuck Lever
Quoted 1 line

Yes and no. I thought the motivation for doing what you currently

do

Quoted 4 lines

was
to avoid mixing AF_INET and AF_INET6 sockets, since the latter listen on
both IPv4 (via the IPv4 mapping) and IPv6?

Quoted 7 lines

AF_INET6 listeners can receive AF_INET packets too, but don't have to. My motivation was to use a single listener so we don't have to support multiple family listeners for each transport protocol in the server-side code. Also, having a separate IPv6-only listener means that someone can come along and hijack the IPv4 packets on that port.

It's just less of a headache with one listener.

The ipv6 manpage says that the port spaces are shared. If so, I don't see how you can have both an AF_INET socket and an AF_INET6 socket bound to the same port.

Quoted 4 lines
Quoted 3 lines

If so, it sounds to me as if
we _must_ have lockd and the callback server set up IPv6 sockets whenever they are available.

Quoted 8 lines

That's what the code does now. The problem is exactly what does "whenever they are available" mean?

Are you suggesting we shouldn't ever fall back to AF_INET? (I'm OK with that answer, but would like a discussion). This means that if I try an IPv4 mount on a system built with an IPv6 module, but the module is unloadable, all mounts (even IPv4) fail outright. Apparently a lot of folks blacklist their IPv6 modules.

I'd rather advocate that we try to use AF_INET6 at service set up time, then fall back on AF_INET only if the former isn't available. I'm not sure that we should allow the user to change the service once it has been set up, since it would appear that would force you to close the current socket, and then reopen a new one of a different type. That's both racy and constitutes an interruption of service.

Cheers
Trond

A message that is not in the archive (sent off-list or not yet received): 1233352740.9741.64.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org

#16 lore raw

Re: [PATCH 1/7] lockd: Use AF_INET6 listener only when IPv6 support is built in

Quoted 14 lines · Trond Myklebust
Quoted 13 lines · Chuck Lever
Quoted 1 line

Yes and no. I thought the motivation for doing what you currently

do

Quoted 4 lines

was
to avoid mixing AF_INET and AF_INET6 sockets, since the latter listen on
both IPv4 (via the IPv4 mapping) and IPv6?

AF_INET6 listeners can receive AF_INET packets too, but don't have to. My motivation was to use a single listener so we don't have to support multiple family listeners for each transport protocol in the server-side code. Also, having a separate IPv6-only listener means that someone can come along and hijack the IPv4 packets on that port.

Quoted 5 lines
Quoted 1 line

It's just less of a headache with one listener.

The ipv6 manpage says that the port spaces are shared. If so, I don't see how you can have both an AF_INET socket and an AF_INET6 socket bound to the same port.

Never mind. I just found the IPV6_V6ONLY socket option. I wonder why that isn't documented in any manpages...

Trond

#17 lore raw

Re: [PATCH 1/7] lockd: Use AF_INET6 listener only when IPv6 support is built in

In reply to a message not in the archive
Quoted 14 lines · Trond Myklebust
Quoted 13 lines · Chuck Lever
Quoted 1 line

Yes and no. I thought the motivation for doing what you currently

do

Quoted 4 lines

was
to avoid mixing AF_INET and AF_INET6 sockets, since the latter listen on
both IPv4 (via the IPv4 mapping) and IPv6?

AF_INET6 listeners can receive AF_INET packets too, but don't have to. My motivation was to use a single listener so we don't have to support multiple family listeners for each transport protocol in the server-side code. Also, having a separate IPv6-only listener means that someone can come along and hijack the IPv4 packets on that port.

Quoted 5 lines
Quoted 1 line

It's just less of a headache with one listener.

The ipv6 manpage says that the port spaces are shared. If so, I don't see how you can have both an AF_INET socket and an AF_INET6 socket bound to the same port.

I've been told that the IPV6_V6ONLY socket option modulates this behavior. If it's set, then the port spaces are separate.

The question is how to deal with mapped IPv4 traffic. if IPV6_V6ONLY is set, then what happens to mapped IPv4 traffic?

Quoted 13 lines
Quoted 4 lines
Quoted 3 lines

If so, it sounds to me as if
we _must_ have lockd and the callback server set up IPv6 sockets whenever they are available.

Quoted 8 lines

That's what the code does now. The problem is exactly what does "whenever they are available" mean?

Are you suggesting we shouldn't ever fall back to AF_INET? (I'm OK with that answer, but would like a discussion). This means that if I try an IPv4 mount on a system built with an IPv6 module, but the module is unloadable, all mounts (even IPv4) fail outright. Apparently a lot of folks blacklist their IPv6 modules.

Quoted 6 lines

I'd rather advocate that we try to use AF_INET6 at service set up time, then fall back on AF_INET only if the former isn't available. I'm not sure that we should allow the user to change the service once it has been set up, since it would appear that would force you to close the current socket, and then reopen a new one of a different type. That's both racy and constitutes an interruption of service.

The listeners will pin the ipv6 module while they exist. At some point, if the listeners are stopped, the ipv6 module can be blacklisted. Subsequent NFS mounts will fail at that point, but a reboot (or perhaps unloading the lockd and nfs modules) will make it right again.

Seems like a good argument for separate listeners.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#18 lore raw

Re: [PATCH 1/7] lockd: Use AF_INET6 listener only when IPv6 support is built in

Quoted 22 lines · Chuck Lever
Quoted 14 lines · Trond Myklebust
Quoted 13 lines · Chuck Lever
Quoted 1 line

Yes and no. I thought the motivation for doing what you currently

do

Quoted 4 lines

was
to avoid mixing AF_INET and AF_INET6 sockets, since the latter listen on
both IPv4 (via the IPv4 mapping) and IPv6?

AF_INET6 listeners can receive AF_INET packets too, but don't have to. My motivation was to use a single listener so we don't have to support multiple family listeners for each transport protocol in the server-side code. Also, having a separate IPv6-only listener means that someone can come along and hijack the IPv4 packets on that port.

Quoted 6 lines
Quoted 1 line

It's just less of a headache with one listener.

The ipv6 manpage says that the port spaces are shared. If so, I don't see how you can have both an AF_INET socket and an AF_INET6 socket bound
to the same port.

Quoted 5 lines

I've been told that the IPV6_V6ONLY socket option modulates this behavior. If it's set, then the port spaces are separate.

The question is how to deal with mapped IPv4 traffic. if IPV6_V6ONLY is set, then what happens to mapped IPv4 traffic?

According to Stevens, the mapped IPv4 traffic is ignored, and so you have to set up an AF_INET socket in order to catch it.

Quoted 21 lines
Quoted 13 lines
Quoted 4 lines
Quoted 3 lines

If so, it sounds to me as if
we _must_ have lockd and the callback server set up IPv6 sockets whenever they are available.

Quoted 8 lines

That's what the code does now. The problem is exactly what does "whenever they are available" mean?

Are you suggesting we shouldn't ever fall back to AF_INET? (I'm OK with that answer, but would like a discussion). This means that if I try an IPv4 mount on a system built with an IPv6 module, but the module is unloadable, all mounts (even IPv4) fail outright. Apparently a lot of folks blacklist their IPv6 modules.

Quoted 7 lines

I'd rather advocate that we try to use AF_INET6 at service set up time,
then fall back on AF_INET only if the former isn't available. I'm not sure that we should allow the user to change the service once it has been set up, since it would appear that would force you to close the current socket, and then reopen a new one of a different type. That's both racy and constitutes an interruption of service.

Quoted 7 lines

The listeners will pin the ipv6 module while they exist. At some point, if the listeners are stopped, the ipv6 module can be blacklisted. Subsequent NFS mounts will fail at that point, but a reboot (or perhaps unloading the lockd and nfs modules) will make it right again.

Seems like a good argument for separate listeners.

My point was that you might lose the IPv4 port, however that's moot when you can set up an IPV6_V6ONLY socket. Note that this appears to be the technique favoured by ssh.

That said, I think I'd prefer the single socket solution that we have now. It would certainly make life easier for migration events, and possibly pnfs. In neither of these cases do you know at mount time what kind of callback service you will need later, so setting up an IPv4-only service might turn out wrong.

Trond

Trond

A message that is not in the archive (sent off-list or not yet received): 1233355782.9741.95.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org

#20 lore raw

Re: [PATCH 1/7] lockd: Use AF_INET6 listener only when IPv6 support is built in

Quoted 5 lines · Trond Myklebust

That said, I think I'd prefer the single socket solution that we have now. It would certainly make life easier for migration events, and possibly pnfs. In neither of these cases do you know at mount time what kind of callback service you will need later, so setting up an IPv4-only service might turn out wrong.

If I understand right, that's an argument for grabbing both ipv4 and ipv6 ports as early as possible.

I don't think that's incompatible with using separate sockets for each. And doing so would simplify adding ipv6 later in situations when it isn't initially available. (But such situations might be rare?)

--b.

#21 lore raw

Re: [PATCH 1/7] lockd: Use AF_INET6 listener only when IPv6 support is built in

In reply to a message not in the archive
Quoted 30 lines · Trond Myklebust
Quoted 29 lines · Chuck Lever
Quoted 14 lines · Trond Myklebust
Quoted 4 lines · Chuck Lever
Quoted 3 lines

If so, it sounds to me as if
we _must_ have lockd and the callback server set up IPv6 sockets whenever they are available.

Quoted 8 lines

That's what the code does now. The problem is exactly what does "whenever they are available" mean?

Are you suggesting we shouldn't ever fall back to AF_INET? (I'm OK with that answer, but would like a discussion). This means that if I try an IPv4 mount on a system built with an IPv6 module, but the module is unloadable, all mounts (even IPv4) fail outright. Apparently a lot of folks blacklist their IPv6 modules.

Quoted 7 lines

I'd rather advocate that we try to use AF_INET6 at service set up time,
then fall back on AF_INET only if the former isn't available. I'm not sure that we should allow the user to change the service once it has been set up, since it would appear that would force you to close the current socket, and then reopen a new one of a different type. That's both racy and constitutes an interruption of service.

The listeners will pin the ipv6 module while they exist. At some point, if the listeners are stopped, the ipv6 module can be blacklisted. Subsequent NFS mounts will fail at that point, but a reboot (or perhaps unloading the lockd and nfs modules) will make it right again.

Quoted 5 lines
Quoted 1 line

Seems like a good argument for separate listeners.

My point was that you might lose the IPv4 port, however that's moot when you can set up an IPV6_V6ONLY socket. Note that this appears to be the technique favoured by ssh.

I've been thinking more about this, and having separate listeners has some appeal. At least as far as I've thought about it, separate listeners simplify the cases where the kernel RPC services have to adapt at run-time to what kind of networking is available in the kernel.

inet6 netids do not support mapped IPv4, as far as I can tell, so if we have an AF_INET listener and an IPV6ONLY AF_INET6 listener, they will get separate traffic streams. It means we avoid entirely having to compare AF_INET addresses to mapped IPv4 AF_INET6 addresses during NFSv4 and NLM callbacks. And, we can always start an AF_INET listener, and start AF_INET6 listeners only if IPv6 support is available in the kernel.

This looks more like TI-RPC's IPv6 support.

Quoted 5 lines

That said, I think I'd prefer the single socket solution that we have now. It would certainly make life easier for migration events, and possibly pnfs. In neither of these cases do you know at mount time what kind of callback service you will need later, so setting up an IPv4-only service might turn out wrong.

I'm not familiar enough with the issues around migration to comment. Do you have an example of a migration event that might be problematic with separate listeners?

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#22 lore raw

Re: [PATCH 1/7] lockd: Use AF_INET6 listener only when IPv6 support is built in

In reply to a message not in the archive
Quoted 6 lines · Chuck Lever

Apparently a lot of people need to completely disable IPv6 on their distribution-built systems, and they do this by blacklisting the ipv6 module. This causes lockd_up(), and thus NFS mounts, to fail in all cases (even for IPv4 mounts) if CONFIG_IPV6_MODULE and CONFIG_SUNRPC_REGISTER_V4 is set.

Quoted 6 lines

As a workaround, change lockd 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 lockd (and eventually NFSD) will be able to handle this case correctly.

I'm curious to see what the long-term fix will be here. (The idea of trying to load the module seems reasonable as a start.) Other than that, I looked throught all the patches and they seem fine.

--b.

Quoted 34 lines

---

 fs/lockd/svc.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
fs/lockd/svc.c +6 -5
index 64f1c31..39ec7f2 100644
@@ -54,14 +54,15 @@ unsigned long			nlmsvc_timeout;
 
 /*
  * 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)) && \
-	defined(CONFIG_SUNRPC_REGISTER_V4)
+#if defined(CONFIG_IPV6) && defined(CONFIG_SUNRPC_REGISTER_V4)
 static const sa_family_t	nlmsvc_family = AF_INET6;
-#else	/* (CONFIG_IPV6 || CONFIG_IPV6_MODULE) && CONFIG_SUNRPC_REGISTER_V4 */
+#else	/* CONFIG_IPV6 && CONFIG_SUNRPC_REGISTER_V4 */
 static const sa_family_t	nlmsvc_family = AF_INET;
-#endif	/* (CONFIG_IPV6 || CONFIG_IPV6_MODULE) && CONFIG_SUNRPC_REGISTER_V4 */
+#endif	/* CONFIG_IPV6 && CONFIG_SUNRPC_REGISTER_V4 */
 
 /*
  * These can be set at insmod time (useful for NFS as root filesystem),
#23 lore raw

PATCH 2/7 SUNRPC: Use IPv4 loopback for registering AF_INET6 kernel RPC services

In reply to a message not in the archive

The kernel uses an IPv6 loopback address when registering its AF_INET6 RPC services so that it can tell whether the local portmapper is actually IPv6-enabled.

Since the legacy portmapper doesn't listen on IPv6, however, this causes a long timeout on older systems if the kernel happens to try creating and registering an AF_INET6 RPC service. Originally I wanted to use a connected transport (either TCP or connected UDP) so that the upcall would fail immediately if the portmapper wasn't listening on IPv6, but we never agreed on what transport to use.

In the end, it's of little consequence to the kernel whether the local portmapper is listening on IPv6. It's only important whether the portmapper supports rpcbind v4. And the kernel can't tell that at all if it is sending requests via IPv6 -- the portmapper will just ignore them.

So, send all SET/UNSET requests via IPv4 loopback to maintain better backwards compatibility between new kernels and legacy user space, and prevent multi-second hangs in some cases when the kernel attempts to register RPC services.

This patch is part of a series that addresses

http://bugzilla.kernel.org/show_bug.cgi?id=12256

---

 net/sunrpc/rpcb_clnt.c |   23 ++++++-----------------
 1 files changed, 6 insertions(+), 17 deletions(-)
net/sunrpc/rpcb_clnt.c +6 -17
index 03ae007..0e9150d 100644
@@ -124,12 +124,6 @@ static const struct sockaddr_in rpcb_inaddr_loopback = {
 	.sin_port		= htons(RPCBIND_PORT),
 };
 
-static const struct sockaddr_in6 rpcb_in6addr_loopback = {
-	.sin6_family		= AF_INET6,
-	.sin6_addr		= IN6ADDR_LOOPBACK_INIT,
-	.sin6_port		= htons(RPCBIND_PORT),
-};
-
 static struct rpc_clnt *rpcb_create_local(struct sockaddr *addr,
 					  size_t addrlen, u32 version)
 {
@@ -176,9 +170,10 @@ static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr,
 	return rpc_create(&args);
 }
 
-static int rpcb_register_call(struct sockaddr *addr, size_t addrlen,
-			      u32 version, struct rpc_message *msg)
+static int rpcb_register_call(u32 version, struct rpc_message *msg)
 {
+	struct sockaddr *addr = (struct sockaddr *)&rpcb_inaddr_loopback;
+	size_t addrlen = sizeof(rpcb_inaddr_loopback);
 	struct rpc_clnt *rpcb_clnt;
 	int result, error = 0;
 
@@ -254,9 +249,7 @@ int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port)
 	if (port)
 		msg.rpc_proc = &rpcb_procedures2[RPCBPROC_SET];
 
-	return rpcb_register_call((struct sockaddr *)&rpcb_inaddr_loopback,
-					sizeof(rpcb_inaddr_loopback),
-					RPCBVERS_2, &msg);
+	return rpcb_register_call(RPCBVERS_2, &msg);
 }
 
 /*
@@ -284,9 +277,7 @@ static int rpcb_register_netid4(struct sockaddr_in *address_to_register,
 	if (port)
 		msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET];
 
-	return rpcb_register_call((struct sockaddr *)&rpcb_inaddr_loopback,
-					sizeof(rpcb_inaddr_loopback),
-					RPCBVERS_4, msg);
+	return rpcb_register_call(RPCBVERS_4, msg);
 }
 
 /*
@@ -318,9 +309,7 @@ static int rpcb_register_netid6(struct sockaddr_in6 *address_to_register,
 	if (port)
 		msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET];
 
-	return rpcb_register_call((struct sockaddr *)&rpcb_in6addr_loopback,
-					sizeof(rpcb_in6addr_loopback),
-					RPCBVERS_4, msg);
+	return rpcb_register_call(RPCBVERS_4, msg);
 }
 
 /**
#24 lore raw

PATCH 3/7 SUNRPC: Don't return EPROTONOSUPPORT in svc_register()'s helpers

In reply to a message not in the archive

The RPC client returns -EPROTONOSUPPORT if there is a protocol version mismatch (ie the remote RPC server doesn't support the RPC protocol version sent by the client).

Helpers for the svc_register() function return -EPROTONOSUPPORT if they don't recognize the passed-in IPPROTO_ value.

These are two entirely different errors.

Have the helpers return -ENOPROTOOPT instead of -ENOPROTOOPT. This will allow callers to determine and report more precisely what the problem is.

This patch is part of a series that addresses
http://bugzilla.kernel.org/show_bug.cgi?id=12256

---

 net/sunrpc/svc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/sunrpc/svc.c +2 -2
index c51fed4..a278a82 100644
@@ -750,7 +750,7 @@ static int __svc_rpcb_register4(const u32 program, const u32 version,
 		netid = RPCBIND_NETID_TCP;
 		break;
 	default:
-		return -EPROTONOSUPPORT;
+		return -ENOPROTOOPT;
 	}
 
 	return rpcb_v4_register(program, version,
@@ -786,7 +786,7 @@ static int __svc_rpcb_register6(const u32 program, const u32 version,
 		netid = RPCBIND_NETID_TCP6;
 		break;
 	default:
-		return -EPROTONOSUPPORT;
+		return -ENOPROTOOPT;
 	}
 
 	return rpcb_v4_register(program, version,
#25 lore raw

PATCH 4/7 SUNRPC: Simplify svc_unregister()

In reply to a message not in the archive

Olaf Kirch says a v2 UNSET should clear all rpcbind entries for an RPC service, even those created with a rpcbind v4 SET. Change svc_unregister() to use a v2 UNSET unconditionally.

This simplifies the code in svc_unregister() and provides better backwards compatibility with legacy user space that does not support rpcbind version 4.

This patch is part of a series that addresses
http://bugzilla.kernel.org/show_bug.cgi?id=12256

---

 net/sunrpc/svc.c |   26 ++++----------------------
 1 files changed, 4 insertions(+), 22 deletions(-)
net/sunrpc/svc.c +4 -22
index a278a82..8dc4a1e 100644
@@ -896,26 +896,10 @@ int svc_register(const struct svc_serv *serv, const unsigned short proto,
 	return error;
 }
 
-#ifdef CONFIG_SUNRPC_REGISTER_V4
-
-static void __svc_unregister(const u32 program, const u32 version,
-			     const char *progname)
-{
-	struct sockaddr_in6 sin6 = {
-		.sin6_family		= AF_INET6,
-		.sin6_addr		= IN6ADDR_ANY_INIT,
-		.sin6_port		= 0,
-	};
-	int error;
-
-	error = rpcb_v4_register(program, version,
-				(struct sockaddr *)&sin6, "");
-	dprintk("svc: %s(%sv%u), error %d\n",
-			__func__, progname, version, error);
-}
-
-#else	/* CONFIG_SUNRPC_REGISTER_V4 */
-
+/*
+ * Olaf says a v2 UNSET should clear _all_ entries, including any
+ * registered via a v4 SET
+ */
 static void __svc_unregister(const u32 program, const u32 version,
 			     const char *progname)
 {
@@ -926,8 +910,6 @@ static void __svc_unregister(const u32 program, const u32 version,
 			__func__, progname, version, error);
 }
 
-#endif	/* CONFIG_SUNRPC_REGISTER_V4 */
-
 /*
  * All netids, bind addresses and ports registered for [program, version]
  * are removed from the local rpcbind database (if the service is not
#26 lore raw

PATCH 5/7 SUNRPC: Simplify kernel RPC service registration

In reply to a message not in the archive

The kernel registers RPC services with the local portmapper with an rpcbind SET upcall to the local portmapper. Traditionally, this used rpcbind v2, but registering RPC services that support IPv6 requires rpcbind v3 or v4.

Previously the kernel used the registration upcall to detect whether user space supported IPv6 for RPC at all, and fail the service creation if it didn't. This is probably unnecessary paranoia.

Since the kernel uses a single listener (either AF_INET or AF_INET6) to handle all requests for a particular RPC service, AF_INET6 listeners handle IPv4 RPC requests too. If user space doesn't allow an AF_INET6 kernel service to be registered, that should be no trouble at all for the kernel's AF_INET6 RPC listener -- it just won't get any RPC requests via IPv6. So we don't need to register the service for IPv6 if user space doesn't allow it.

So, we try registration via rpcbind v4 first; if that fails, we retry with rpcbind v2, and support only IPv4 requests.

This provides complete backwards compatibilty with legacy user space that only supports rpcbind v2. The only down-side is that registering a new kernel RPC service may take an extra exchange with the local portmapper, but this is an infrequent operation, so it shouldn't matter.

This patch is part of a series that addresses
http://bugzilla.kernel.org/show_bug.cgi?id=12256

---

 net/sunrpc/svc.c |   50 ++++++++++++++++++++++++--------------------------
 1 files changed, 24 insertions(+), 26 deletions(-)
net/sunrpc/svc.c +24 -26
index 8dc4a1e..3cf1b3c 100644
@@ -719,8 +719,6 @@ svc_exit_thread(struct svc_rqst *rqstp)
 }
 EXPORT_SYMBOL_GPL(svc_exit_thread);
 
-#ifdef CONFIG_SUNRPC_REGISTER_V4
-
 /*
  * Register an "inet" protocol family netid with the local
  * rpcbind daemon via an rpcbind v4 SET request.
@@ -741,6 +739,7 @@ static int __svc_rpcb_register4(const u32 program, const u32 version,
 		.sin_port		= htons(port),
 	};
 	char *netid;
+	int error;
 
 	switch (protocol) {
 	case IPPROTO_UDP:
@@ -753,8 +752,17 @@ static int __svc_rpcb_register4(const u32 program, const u32 version,
 		return -ENOPROTOOPT;
 	}
 
-	return rpcb_v4_register(program, version,
-				(struct sockaddr *)&sin, netid);
+	error = rpcb_v4_register(program, version,
+					(struct sockaddr *)&sin, netid);
+
+	/*
+	 * User space didn't support rpcbind v4, so retry this
+	 * registration request with the legacy rpcbind v2 protocol.
+	 */
+	if (error == -EPROTONOSUPPORT)
+		error = rpcb_register(program, version, protocol, port);
+
+	return error;
 }
 
 /*
@@ -777,6 +785,7 @@ static int __svc_rpcb_register6(const u32 program, const u32 version,
 		.sin6_port		= htons(port),
 	};
 	char *netid;
+	int error;
 
 	switch (protocol) {
 	case IPPROTO_UDP:
@@ -789,8 +798,18 @@ static int __svc_rpcb_register6(const u32 program, const u32 version,
 		return -ENOPROTOOPT;
 	}
 
-	return rpcb_v4_register(program, version,
+	error = rpcb_v4_register(program, version,
 				(struct sockaddr *)&sin6, netid);
+
+	/*
+	 * User space didn't support registering an IPv6 service,
+	 * so register this service for IPv4 only, using the legacy
+	 * rpcbind v2 protocol.
+	 */
+	if (error == -EPROTONOSUPPORT)
+		error = rpcb_register(program, version, protocol, port);
+
+	return error;
 }
 
 /*
@@ -831,27 +850,6 @@ static int __svc_register(const u32 program, const u32 version,
 	return -EAFNOSUPPORT;
 }
 
-#else	/* CONFIG_SUNRPC_REGISTER_V4 */
-
-/*
- * Register a kernel RPC service via rpcbind version 2.
- *
- * Returns zero on success; a negative errno value is returned
- * if any error occurs.
- */
-static int __svc_register(const u32 program, const u32 version,
-			  sa_family_t family,
-			  const unsigned short protocol,
-			  const unsigned short port)
-{
-	if (family != AF_INET)
-		return -EAFNOSUPPORT;
-
-	return rpcb_register(program, version, protocol, port);
-}
-
-#endif /* CONFIG_SUNRPC_REGISTER_V4 */
-
 /**
  * svc_register - register an RPC service with the local portmapper
  * @serv: svc_serv struct for the service to register
#27 lore raw

PATCH 6/7 SUNRPC: rpcb_register() should handle errors silently

In reply to a message not in the archive

Move error reporting for RPC registration to rpcb_register's caller.

This way the caller can recover silently from certain errors, but report errors it does not recognize.

This patch is part of a series that addresses
http://bugzilla.kernel.org/show_bug.cgi?id=12256

---

 net/sunrpc/rpcb_clnt.c |    2 +-
 net/sunrpc/svc.c       |   22 +++++++++++++++-------
 2 files changed, 16 insertions(+), 8 deletions(-)
net/sunrpc/rpcb_clnt.c +1 -1
index 0e9150d..888c205 100644
@@ -187,7 +187,7 @@ static int rpcb_register_call(u32 version, struct rpc_message *msg)
 		error = PTR_ERR(rpcb_clnt);
 
 	if (error < 0) {
-		printk(KERN_WARNING "RPC: failed to contact local rpcbind "
+		dprintk("RPC:       failed to contact local rpcbind "
 				"server (errno %d).\n", -error);
 		return error;
 	}
net/sunrpc/svc.c +15 -7
index 3cf1b3c..5baac0a 100644
@@ -818,7 +818,8 @@ static int __svc_rpcb_register6(const u32 program, const u32 version,
  * Returns zero on success; a negative errno value is returned
  * if any error occurs.
  */
-static int __svc_register(const u32 program, const u32 version,
+static int __svc_register(const char *progname,
+			  const u32 program, const u32 version,
 			  const sa_family_t family,
 			  const unsigned short protocol,
 			  const unsigned short port)
@@ -827,13 +828,14 @@ static int __svc_register(const u32 program, const u32 version,
 
 	switch (family) {
 	case AF_INET:
-		return __svc_rpcb_register4(program, version,
+		error = __svc_rpcb_register4(program, version,
 						protocol, port);
+		break;
 	case AF_INET6:
 		error = __svc_rpcb_register6(program, version,
 						protocol, port);
 		if (error < 0)
-			return error;
+			break;
 
 		/*
 		 * Work around bug in some versions of Linux rpcbind
@@ -844,10 +846,15 @@ static int __svc_register(const u32 program, const u32 version,
 		 */
 		__svc_rpcb_register4(program, version,
 						protocol, port);
-		return 0;
+		break;
+	default:
+		error = -EAFNOSUPPORT;
 	}
 
-	return -EAFNOSUPPORT;
+	if (error < 0)
+		printk(KERN_WARNING "svc: failed to register %sv%u RPC "
+			"service (errno %d).\n", progname, version, -error);
+	return error;
 }
 
 /**
@@ -884,8 +891,9 @@ int svc_register(const struct svc_serv *serv, const unsigned short proto,
 			if (progp->pg_vers[i]->vs_hidden)
 				continue;
 
-			error = __svc_register(progp->pg_prog, i,
-						serv->sv_family, proto, port);
+			error = __svc_register(progp->pg_name, progp->pg_prog,
+						i, serv->sv_family,
+						proto, port);
 			if (error < 0)
 				break;
 		}
#28 lore raw

PATCH 7/7 SUNRPC: Remove CONFIG_SUNRPC_REGISTER_V4

In reply to a message not in the archive

We just augmented the kernel's RPC service registration code so that it automatically adjusts to what is supported in user space. Thus we no longer need the kernel configuration option to enable registering RPC services with v4 -- it's all done automatically.

This patch is part of a series that addresses
http://bugzilla.kernel.org/show_bug.cgi?id=12256

---

 fs/lockd/svc.c     |    6 +++---
 net/sunrpc/Kconfig |   22 ----------------------
 2 files changed, 3 insertions(+), 25 deletions(-)
fs/lockd/svc.c +3 -3
index 39ec7f2..db5acc3 100644
@@ -58,11 +58,11 @@ unsigned long			nlmsvc_timeout;
  * 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_SUNRPC_REGISTER_V4)
+#if defined(CONFIG_IPV6)
 static const sa_family_t	nlmsvc_family = AF_INET6;
-#else	/* CONFIG_IPV6 && CONFIG_SUNRPC_REGISTER_V4 */
+#else	/* CONFIG_IPV6 */
 static const sa_family_t	nlmsvc_family = AF_INET;
-#endif	/* CONFIG_IPV6 && CONFIG_SUNRPC_REGISTER_V4 */
+#endif	/* CONFIG_IPV6 */
 
 /*
  * These can be set at insmod time (useful for NFS as root filesystem),
net/sunrpc/Kconfig +0 -22
index dcef600..45e275a 100644
@@ -17,28 +17,6 @@ config SUNRPC_XPRT_RDMA
 
 	  If unsure, say N.
 
-config SUNRPC_REGISTER_V4
-	bool "Register local RPC services via rpcbind v4 (EXPERIMENTAL)"
-	depends on SUNRPC && EXPERIMENTAL
-	default n
-	help
-	  Sun added support for registering RPC services at an IPv6
-	  address by creating two new versions of the rpcbind protocol
-	  (RFC 1833).
-
-	  This option enables support in the kernel RPC server for
-	  registering kernel RPC services via version 4 of the rpcbind
-	  protocol.  If you enable this option, you must run a portmapper
-	  daemon that supports rpcbind protocol version 4.
-
-	  Serving NFS over IPv6 from knfsd (the kernel's NFS server)
-	  requires that you enable this option and use a portmapper that
-	  supports rpcbind version 4.
-
-	  If unsure, say N to get traditional behavior (register kernel
-	  RPC services using only rpcbind version 2).  Distributions
-	  using the legacy Linux portmapper daemon must say N here.
-
 config RPCSEC_GSS_KRB5
 	tristate "Secure RPC: Kerberos V mechanism (EXPERIMENTAL)"
 	depends on SUNRPC && EXPERIMENTAL
#29 lore raw
In reply to a message not in the archive
Quoted 8 lines · Chuck Lever

Updated patch series to remove the SUNRPC_REGISTER_V4 kernel build option. These address kernel bugzilla 12256 ("RPC: failed to contact local rpcbind server (errno 5)." if CONFIG_SUNRPC_REGISTER_V4 is set to Y"). Please include them in your for-2.6.30 branch, replacing any previous version of this patch series.

There may be some problems applying this patch set to linux-next, as that may have recent patches that split up fs/Kconfig.

Actually, those patches are in mainline (and my for-2.6.30 branch); would you like to rebase? It should be trivial.

--b.

#30 lore raw
Quoted 7 lines · J. Bruce Fields
Quoted 6 lines · Chuck Lever

Updated patch series to remove the SUNRPC_REGISTER_V4 kernel build option. These address kernel bugzilla 12256 ("RPC: failed to contact local rpcbind server (errno 5)." if CONFIG_SUNRPC_REGISTER_V4 is set to Y"). Please include them in your for-2.6.30 branch, replacing any previous version of this patch series.

Quoted 5 lines
Quoted 2 lines

There may be some problems applying this patch set to linux-next, as that may have recent patches that split up fs/Kconfig.

Actually, those patches are in mainline (and my for-2.6.30 branch); would you like to rebase? It should be trivial.

Ignore that last paragraph, I just copied it from the previous post. Today's series should be all set.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com