SUNRPC: Simplify kernel RPC service registration
authorChuck Lever <chuck.lever@oracle.com>
Thu, 19 Mar 2009 00:47:36 +0000 (20:47 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 28 Mar 2009 19:58:37 +0000 (15:58 -0400)
commitcadc0fa534e51e20fdffe1623913c163a18d71b1
tree51d41748b7c98eab0749d033b174b0584e25088a
parentd5a8620f7c8a5bcade730e2fa1224191f289fb00
SUNRPC: Simplify kernel RPC service registration

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

Since we now want separate PF_INET and PF_INET6 listeners for each
kernel RPC service, svc_register() will do only one of those
registrations at a time.

For PF_INET, it tries an rpcb v4 SET upcall first; if that fails, it
does a legacy portmap SET.  This makes it entirely backwards
compatible with legacy user space, but allows a proper v4 SET to be
used if rpcbind is available.

For PF_INET6, it does an rpcb v4 SET upcall.  If that fails, it fails
the registration, and thus the transport creation.  This let's the
kernel detect if user space is able to support IPv6 RPC services, and
thus whether it should maintain a PF_INET6 listener for each service
at all.

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 on legacy systems, but this is an infrequent operation and
is done over UDP (no lingering sockets in TIMEWAIT), so it shouldn't
be consequential.

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

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
net/sunrpc/svc.c