1. 03 1月, 2019 1 次提交
  2. 20 12月, 2018 4 次提交
    • N
      NFS/NFSD/SUNRPC: replace generic creds with 'struct cred'. · a52458b4
      NeilBrown 提交于
      SUNRPC has two sorts of credentials, both of which appear as
      "struct rpc_cred".
      There are "generic credentials" which are supplied by clients
      such as NFS and passed in 'struct rpc_message' to indicate
      which user should be used to authorize the request, and there
      are low-level credentials such as AUTH_NULL, AUTH_UNIX, AUTH_GSS
      which describe the credential to be sent over the wires.
      
      This patch replaces all the generic credentials by 'struct cred'
      pointers - the credential structure used throughout Linux.
      
      For machine credentials, there is a special 'struct cred *' pointer
      which is statically allocated and recognized where needed as
      having a special meaning.  A look-up of a low-level cred will
      map this to a machine credential.
      Signed-off-by: NNeilBrown <neilb@suse.com>
      Acked-by: NJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: NAnna Schumaker <Anna.Schumaker@Netapp.com>
      a52458b4
    • N
      SUNRPC: add side channel to use non-generic cred for rpc call. · 1de7eea9
      NeilBrown 提交于
      The credential passed in rpc_message.rpc_cred is always a
      generic credential except in one instance.
      When gss_destroying_context() calls rpc_call_null(), it passes
      a specific credential that it needs to destroy.
      In this case the RPC acts *on* the credential rather than
      being authorized by it.
      
      This special case deserves explicit support and providing that will
      mean that rpc_message.rpc_cred is *always* generic, allowing
      some optimizations.
      
      So add "tk_op_cred" to rpc_task and "rpc_op_cred" to the setup data.
      Use this to pass the cred down from rpc_call_null(), and have
      rpcauth_bindcred() notice it and bind it in place.
      
      Credit to kernel test robot <fengguang.wu@intel.com> for finding
      a bug in earlier version of this patch.
      Signed-off-by: NNeilBrown <neilb@suse.com>
      Signed-off-by: NAnna Schumaker <Anna.Schumaker@Netapp.com>
      1de7eea9
    • N
      SUNRPC: introduce RPC_TASK_NULLCREDS to request auth_none · a68a72e1
      NeilBrown 提交于
      In almost all cases the credential stored in rpc_message.rpc_cred
      is a "generic" credential.  One of the two expections is when an
      AUTH_NULL credential is used such as for RPC ping requests.
      
      To improve consistency, don't pass an explicit credential in
      these cases, but instead pass NULL and set a task flag,
      similar to RPC_TASK_ROOTCREDS, which requests that NULL credentials
      be used by default.
      Signed-off-by: NNeilBrown <neilb@suse.com>
      Signed-off-by: NAnna Schumaker <Anna.Schumaker@Netapp.com>
      a68a72e1
    • N
      NFS/SUNRPC: don't lookup machine credential until rpcauth_bindcred(). · 5e16923b
      NeilBrown 提交于
      When NFS creates a machine credential, it is a "generic" credential,
      not tied to any auth protocol, and is really just a container for
      the princpal name.
      This doesn't get linked to a genuine credential until rpcauth_bindcred()
      is called.
      The lookup always succeeds, so various places that test if the machine
      credential is NULL, are pointless.
      
      As a step towards getting rid of generic credentials, this patch gets
      rid of generic machine credentials.  The nfs_client and rpc_client
      just hold a pointer to a constant principal name.
      When a machine credential is wanted, a special static 'struct rpc_cred'
      pointer is used. rpcauth_bindcred() recognizes this, finds the
      principal from the client, and binds the correct credential.
      Signed-off-by: NNeilBrown <neilb@suse.com>
      Signed-off-by: NAnna Schumaker <Anna.Schumaker@Netapp.com>
      5e16923b
  3. 19 12月, 2018 1 次提交
  4. 02 12月, 2018 2 次提交
  5. 01 10月, 2018 16 次提交
  6. 01 8月, 2018 2 次提交
  7. 07 5月, 2018 1 次提交
  8. 11 4月, 2018 2 次提交
  9. 13 2月, 2018 1 次提交
    • D
      net: make getname() functions return length rather than use int* parameter · 9b2c45d4
      Denys Vlasenko 提交于
      Changes since v1:
      Added changes in these files:
          drivers/infiniband/hw/usnic/usnic_transport.c
          drivers/staging/lustre/lnet/lnet/lib-socket.c
          drivers/target/iscsi/iscsi_target_login.c
          drivers/vhost/net.c
          fs/dlm/lowcomms.c
          fs/ocfs2/cluster/tcp.c
          security/tomoyo/network.c
      
      Before:
      All these functions either return a negative error indicator,
      or store length of sockaddr into "int *socklen" parameter
      and return zero on success.
      
      "int *socklen" parameter is awkward. For example, if caller does not
      care, it still needs to provide on-stack storage for the value
      it does not need.
      
      None of the many FOO_getname() functions of various protocols
      ever used old value of *socklen. They always just overwrite it.
      
      This change drops this parameter, and makes all these functions, on success,
      return length of sockaddr. It's always >= 0 and can be differentiated
      from an error.
      
      Tests in callers are changed from "if (err)" to "if (err < 0)", where needed.
      
      rpc_sockname() lost "int buflen" parameter, since its only use was
      to be passed to kernel_getsockname() as &buflen and subsequently
      not used in any way.
      
      Userspace API is not changed.
      
          text    data     bss      dec     hex filename
      30108430 2633624  873672 33615726 200ef6e vmlinux.before.o
      30108109 2633612  873672 33615393 200ee21 vmlinux.o
      Signed-off-by: NDenys Vlasenko <dvlasenk@redhat.com>
      CC: David S. Miller <davem@davemloft.net>
      CC: linux-kernel@vger.kernel.org
      CC: netdev@vger.kernel.org
      CC: linux-bluetooth@vger.kernel.org
      CC: linux-decnet-user@lists.sourceforge.net
      CC: linux-wireless@vger.kernel.org
      CC: linux-rdma@vger.kernel.org
      CC: linux-sctp@vger.kernel.org
      CC: linux-nfs@vger.kernel.org
      CC: linux-x25@vger.kernel.org
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9b2c45d4
  10. 15 1月, 2018 1 次提交
  11. 01 12月, 2017 1 次提交
  12. 18 11月, 2017 2 次提交
  13. 07 9月, 2017 1 次提交
    • N
      SUNRPC: remove some dead code. · f1ecbc21
      NeilBrown 提交于
      RPC_TASK_NO_RETRANS_TIMEOUT is set when cl_noretranstimeo
      is set, which happens when  RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT is set,
      which happens when NFS_CS_NO_RETRANS_TIMEOUT is set.
      
      This flag means "don't resend on a timeout, only resend if the
      connection gets broken for some reason".
      
      cl_discrtry is set when RPC_CLNT_CREATE_DISCRTRY is set, which
      happens when NFS_CS_DISCRTRY is set.
      
      This flag means "always disconnect before resending".
      
      NFS_CS_NO_RETRANS_TIMEOUT and NFS_CS_DISCRTRY are both only set
      in nfs4_init_client(), and it always sets both.
      
      So we will never have a situation where only one of the flags is set.
      So this code, which tests if timeout retransmits are allowed, and
      disconnection is required, will never run.
      
      So it makes sense to remove this code as it cannot be tested and
      could confuse people reading the code (like me).
      
      (alternately we could leave it there with a comment saying
       it is never actually used).
      Signed-off-by: NNeilBrown <neilb@suse.com>
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      f1ecbc21
  14. 21 8月, 2017 1 次提交
    • N
      SUNRPC: ECONNREFUSED should cause a rebind. · fd01b259
      NeilBrown 提交于
      If you
       - mount and NFSv3 filesystem
       - do some file locking which requires the server
         to make a GRANT call back
       - unmount
       - mount again and do the same locking
      
      then the second attempt at locking suffers a 30 second delay.
      Unmounting and remounting causes lockd to stop and restart,
      which causes it to bind to a new port.
      The server still thinks the old port is valid and gets ECONNREFUSED
      when trying to contact it.
      ECONNREFUSED should be seen as a hard error that is not worth
      retrying.  Rebinding is the only reasonable response.
      
      This patch forces a rebind if that makes sense.
      Signed-off-by: NNeilBrown <neilb@suse.com>
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      fd01b259
  15. 14 7月, 2017 4 次提交