1. 29 3月, 2009 14 次提交
    • C
      SUNRPC: Simplify kernel RPC service registration · cadc0fa5
      Chuck Lever 提交于
      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=12256Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      cadc0fa5
    • C
      SUNRPC: Simplify svc_unregister() · d5a8620f
      Chuck Lever 提交于
      Our initial implementation of svc_unregister() assumed that PMAP_UNSET
      cleared all rpcbind registrations for a [program, version] tuple.
      However, we now have evidence that PMAP_UNSET clears only "inet"
      entries, and not "inet6" entries, in the rpcbind database.
      
      For backwards compatibility with the legacy portmapper, the
      svc_unregister() function also must work if user space doesn't support
      rpcbind version 4 at all.
      
      Thus we'll send an rpcbind v4 UNSET, and if that fails, we'll send a
      PMAP_UNSET.
      
      This simplifies the code in svc_unregister() and provides better
      backwards compatibility with legacy user space that does not support
      rpcbind version 4.  We can get rid of the conditional compilation in
      here as well.
      
      This patch is part of a series that addresses
         http://bugzilla.kernel.org/show_bug.cgi?id=12256Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      d5a8620f
    • C
      SUNRPC: Allow callers to pass rpcb_v4_register a NULL address · 1673d0de
      Chuck Lever 提交于
      The user space TI-RPC library uses an empty string for the universal
      address when unregistering all target addresses for [program, version].
      The kernel's rpcb client should behave the same way.
      
      Here, we are switching between several registration methods based on
      the protocol family of the incoming address.  Rename the other rpcbind
      v4 registration functions to make it clear that they, as well, are
      switched on protocol family.  In /etc/netconfig, this is either "inet"
      or "inet6".
      
      NB: The loopback protocol families are not supported in the kernel.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      1673d0de
    • C
      SUNRPC: rpcbind actually interprets r_owner string · 126e4bc3
      Chuck Lever 提交于
      RFC 1833 has little to say about the contents of r_owner; it only
      specifies that it is a string, and states that it is used to control
      who can UNSET an entry.
      
      Our port of rpcbind (from Sun) assumes this string contains a numeric
      UID value, not alphabetical or symbolic characters, but checks this
      value only for AF_LOCAL RPCB_SET or RPCB_UNSET requests.  In all other
      cases, rpcbind ignores the contents of the r_owner string.
      
      The reference user space implementation of rpcb_set(3) uses a numeric
      UID for all SET/UNSET requests (even via the network) and an empty
      string for all other requests.  We emulate that behavior here to
      maintain bug-for-bug compatibility.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      126e4bc3
    • C
      SUNRPC: Clean up address type casts in rpcb_v4_register() · 3aba4553
      Chuck Lever 提交于
      Clean up: Simplify rpcb_v4_register() and its helpers by moving the
      details of sockaddr type casting to rpcb_v4_register()'s helper
      functions.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      3aba4553
    • C
      SUNRPC: Don't return EPROTONOSUPPORT in svc_register()'s helpers · ba5c35e0
      Chuck Lever 提交于
      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 failure modes.
      
      Have the helpers return -ENOPROTOOPT instead of -EPROTONOSUPPORT.  This
      will allow callers to determine more precisely what the underlying
      problem is, and decide to report or recover appropriately.
      
      This patch is part of a series that addresses
         http://bugzilla.kernel.org/show_bug.cgi?id=12256Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      ba5c35e0
    • C
      SUNRPC: Use IPv4 loopback for registering AF_INET6 kernel RPC services · fc28decd
      Chuck Lever 提交于
      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 both rpcbind v2 and v4 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=12256Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      fc28decd
    • C
      SUNRPC: Set IPV6ONLY flag on PF_INET6 RPC listener sockets · 7d21c0f9
      Chuck Lever 提交于
      We are about to convert to using separate RPC listener sockets for
      PF_INET and PF_INET6.  This echoes the way IPv6 is handled in user
      space by TI-RPC, and eliminates the need for ULPs to worry about
      mapped IPv4 AF_INET6 addresses when doing address comparisons.
      
      Start by setting the IPV6ONLY flag on PF_INET6 RPC listener sockets.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      7d21c0f9
    • C
      SUNRPC: Remove @family argument from svc_create() and svc_create_pooled() · 49a9072f
      Chuck Lever 提交于
      Since an RPC service listener's protocol family is specified now via
      svc_create_xprt(), it no longer needs to be passed to svc_create() or
      svc_create_pooled().  Remove that argument from the synopsis of those
      functions, and remove the sv_family field from the svc_serv struct.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      49a9072f
    • C
      SUNRPC: Change svc_create_xprt() to take a @family argument · 9652ada3
      Chuck Lever 提交于
      The sv_family field is going away.  Pass a protocol family argument to
      svc_create_xprt() instead of extracting the family from the passed-in
      svc_serv struct.
      
      Again, as this is a listener socket and not an address, we make this
      new argument an "int" protocol family, instead of an "sa_family_t."
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      9652ada3
    • C
      SUNRPC: svc_setup_socket() gets protocol family from socket · baf01caf
      Chuck Lever 提交于
      Since the sv_family field is going away, modify svc_setup_socket() to
      extract the protocol family from the passed-in socket instead of from
      the passed-in svc_serv struct.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      baf01caf
    • C
      SUNRPC: Pass a family argument to svc_register() · 4b62e58c
      Chuck Lever 提交于
      The sv_family field is going away.  Instead of using sv_family, have
      the svc_register() function take a protocol family argument.
      
      Since this argument represents a protocol family, and not an address
      family, this argument takes an int, as this is what is passed to
      sock_create_kern().  Also make sure svc_register's helpers are
      checking for PF_FOO instead of AF_FOO.  The value of [AP]F_FOO are
      equivalent; this is simply a symbolic change to reflect the semantics
      of the value stored in that variable.
      
      sock_create_kern() should return EPFNOSUPPORT if the passed-in
      protocol family isn't supported, but it uses EAFNOSUPPORT for this
      case.  We will stick with that tradition here, as svc_register()
      is called by the RPC server in the same path as sock_create_kern().
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      4b62e58c
    • C
      SUNRPC: Clean up svc_find_xprt() calling sequence · 156e6209
      Chuck Lever 提交于
      Clean up: add documentating comment and use appropriate data types for
      svc_find_xprt()'s arguments.
      
      This also eliminates a mixed sign comparison: @port was an int, while
      the return value of svc_xprt_local_port() is an unsigned short.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      156e6209
    • C
      SUNRPC: Don't flag empty RPCB_GETADDR reply as bogus · 776bd5c7
      Chuck Lever 提交于
      In 2007, commit e65fe397 added
      additional sanity checking to rpcb_decode_getaddr() to make sure we
      were getting a reply that was long enough to be an actual universal
      address.  If the uaddr string isn't long enough, the XDR decoder
      returns EIO.
      
      However, an empty string is a valid RPCB_GETADDR response if the
      requested service isn't registered.  Moreover, "::.n.m" is also a
      valid RPCB_GETADDR response for IPv6 addresses that is shorter
      than rpcb_decode_getaddr()'s lower limit of 11.  So this sanity
      check introduced a regression for rpcbind requests against IPv6
      remotes.
      
      So revert the lower bound check added by commit
      e65fe397, and add an explicit check
      for an empty uaddr string, similar to libtirpc's rpcb_getaddr(3).
      Pointed-out-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      776bd5c7
  2. 20 3月, 2009 5 次提交
  3. 12 3月, 2009 14 次提交
  4. 11 3月, 2009 1 次提交
    • T
      SUNRPC: Tighten up the task locking rules in __rpc_execute() · eb9b55ab
      Trond Myklebust 提交于
      We should probably not be testing any flags after we've cleared the
      RPC_TASK_RUNNING flag, since rpc_make_runnable() is then free to assign the
      rpc_task to another workqueue, which may then destroy it.
      
      We can fix any races with rpc_make_runnable() by ensuring that we only
      clear the RPC_TASK_RUNNING flag while holding the rpc_wait_queue->lock that
      the task is supposed to be sleeping on (and then checking whether or not
      the task really is sleeping).
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      eb9b55ab
  5. 04 2月, 2009 1 次提交
    • R
      sunrpc: fix rdma dependencies · 55128bc2
      Randy Dunlap 提交于
      Fix sunrpc/rdma build dependencies.
      Survives 12 build combinations of INET, IPV6, SUNRPC,
      INFINIBAND, and INFINIBAND_ADDR_TRANS.
      
      ERROR: "rdma_destroy_id" [net/sunrpc/xprtrdma/xprtrdma.ko] undefined!
      ERROR: "rdma_connect" [net/sunrpc/xprtrdma/xprtrdma.ko] undefined!
      ERROR: "rdma_destroy_qp" [net/sunrpc/xprtrdma/xprtrdma.ko] undefined!
      ERROR: "rdma_create_id" [net/sunrpc/xprtrdma/xprtrdma.ko] undefined!
      ERROR: "rdma_create_qp" [net/sunrpc/xprtrdma/xprtrdma.ko] undefined!
      ERROR: "rdma_resolve_route" [net/sunrpc/xprtrdma/xprtrdma.ko] undefined!
      ERROR: "rdma_disconnect" [net/sunrpc/xprtrdma/xprtrdma.ko] undefined!
      ERROR: "rdma_resolve_addr" [net/sunrpc/xprtrdma/xprtrdma.ko] undefined!
      ERROR: "rdma_accept" [net/sunrpc/xprtrdma/svcrdma.ko] undefined!
      ERROR: "rdma_destroy_id" [net/sunrpc/xprtrdma/svcrdma.ko] undefined!
      ERROR: "rdma_listen" [net/sunrpc/xprtrdma/svcrdma.ko] undefined!
      ERROR: "rdma_create_id" [net/sunrpc/xprtrdma/svcrdma.ko] undefined!
      ERROR: "rdma_create_qp" [net/sunrpc/xprtrdma/svcrdma.ko] undefined!
      ERROR: "rdma_bind_addr" [net/sunrpc/xprtrdma/svcrdma.ko] undefined!
      ERROR: "rdma_disconnect" [net/sunrpc/xprtrdma/svcrdma.ko] undefined!
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      55128bc2
  6. 28 1月, 2009 1 次提交
  7. 22 1月, 2009 1 次提交
  8. 08 1月, 2009 3 次提交