1. 28 2月, 2013 1 次提交
  2. 13 12月, 2012 1 次提交
    • N
      NFS: avoid NULL dereference in nfs_destroy_server · f259613a
      NeilBrown 提交于
      In rare circumstances, nfs_clone_server() of a v2 or v3 server can get
      an error between setting server->destory (to nfs_destroy_server), and
      calling nfs_start_lockd (which will set server->nlm_host).
      
      If this happens, nfs_clone_server will call nfs_free_server which
      will call nfs_destroy_server and thence nlmclnt_done(NULL).  This
      causes the NULL to be dereferenced.
      
      So add a guard to only call nlmclnt_done() if ->nlm_host is not NULL.
      
      The other guards there are irrelevant as nlm_host can only be non-NULL
      if one of these flags are set - so remove those tests.  (Thanks to Trond
      for this suggestion).
      
      This is suitable for any stable kernel since 2.6.25.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      f259613a
  3. 05 11月, 2012 1 次提交
  4. 02 10月, 2012 5 次提交
    • Y
      NFS: Remove unnecessary semicolons (fs/nfs/client.c) · ee34e136
      Yanchuan Nian 提交于
      There are some unnecessary semicolons in function find_nfs_version. Just remove them.
      Signed-off-by: NYanchuan Nian <ycnian@gmail.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      ee34e136
    • P
      NFS41: fix error of setting blocklayoutdriver · dc182549
      Peng Tao 提交于
      After commit e38eb650 (NFS: set_pnfs_layoutdriver() from
      nfs4_proc_fsinfo()), set_pnfs_layoutdriver() is called inside
      nfs4_proc_fsinfo(), but pnfs_blksize is not set. It causes setting
      blocklayoutdriver failure and pnfsblock mount failure.
      
      Cc: stable <stable@vger.kernel.org> [since v3.5]
      Signed-off-by: NPeng Tao <tao.peng@emc.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      dc182549
    • C
      NFS: Discover NFSv4 server trunking when mounting · 05f4c350
      Chuck Lever 提交于
      "Server trunking" is a fancy named for a multi-homed NFS server.
      Trunking might occur if a client sends NFS requests for a single
      workload to multiple network interfaces on the same server.  There
      are some implications for NFSv4 state management that make it useful
      for a client to know if a single NFSv4 server instance is
      multi-homed.  (Note this is only a consideration for NFSv4, not for
      legacy versions of NFS, which are stateless).
      
      If a client cares about server trunking, no NFSv4 operations can
      proceed until that client determines who it is talking to.  Thus
      server IP trunking discovery must be done when the client first
      encounters an unfamiliar server IP address.
      
      The nfs_get_client() function walks the nfs_client_list and matches
      on server IP address.  The outcome of that walk tells us immediately
      if we have an unfamiliar server IP address.  It invokes
      nfs_init_client() in this case.  Thus, nfs4_init_client() is a good
      spot to perform trunking discovery.
      
      Discovery requires a client to establish a fresh client ID, so our
      client will now send SETCLIENTID or EXCHANGE_ID as the first NFS
      operation after a successful ping, rather than waiting for an
      application to perform an operation that requires NFSv4 state.
      
      The exact process for detecting trunking is different for NFSv4.0 and
      NFSv4.1, so a minorversion-specific init_client callout method is
      introduced.
      
      CLID_INUSE recovery is important for the trunking discovery process.
      CLID_INUSE is a sign the server recognizes the client's nfs_client_id4
      id string, but the client is using the wrong principal this time for
      the SETCLIENTID operation.  The SETCLIENTID must be retried with a
      series of different principals until one works, and then the rest of
      trunking discovery can proceed.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      05f4c350
    • C
      NFS: Introduce "migration" mount option · 89652617
      Chuck Lever 提交于
      Currently, the Linux client uses a unique nfs_client_id4.id string
      when identifying itself to distinct NFS servers.
      
      To support transparent state migration, the Linux client will have to
      use the same nfs_client_id4 string for all servers it communicates
      with (also known as the "uniform client string" approach).  Otherwise
      NFS servers can not recognize that open and lock state need to be
      merged after a file system transition.
      
      Unfortunately, there are some NFSv4.0 servers currently in the field
      that do not tolerate the uniform client string approach.
      
      Thus, by default, our NFSv4.0 mounts will continue to use the current
      approach, and we introduce a mount option that switches them to use
      the uniform model.  Client administrators must identify which servers
      can be mounted with this option.  Eventually most NFSv4.0 servers will
      be able to handle the uniform approach, and we can change the default.
      
      The first mount of a server controls the behavior for all subsequent
      mounts for the lifetime of that set of mounts of that server.  After
      the last mount of that server is gone, the client erases the data
      structure that tracks the lease.  A subsequent lease may then honor
      a different "migration" setting.
      
      This patch adds only the infrastructure for parsing the new mount
      option.  Support for uniform client strings is added in a subsequent
      patch.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      89652617
    • C
      SUNRPC: Introduce rpc_clone_client_set_auth() · ba9b584c
      Chuck Lever 提交于
      An ULP is supposed to be able to replace a GSS rpc_auth object with
      another GSS rpc_auth object using rpcauth_create().  However,
      rpcauth_create() in 3.5 reliably fails with -EEXIST in this case.
      This is because when gss_create() attempts to create the upcall pipes,
      sometimes they are already there.  For example if a pipe FS mount
      event occurs, or a previous GSS flavor was in use for this rpc_clnt.
      
      It turns out that's not the only problem here.  While working on a
      fix for the above problem, we noticed that replacing an rpc_clnt's
      rpc_auth is not safe, since dereferencing the cl_auth field is not
      protected in any way.
      
      So we're deprecating the ability of rpcauth_create() to switch an
      rpc_clnt's security flavor during normal operation.  Instead, let's
      add a fresh API that clones an rpc_clnt and gives the clone a new
      flavor before it's used.
      
      This makes immediate use of the new __rpc_clone_client() helper.
      
      This can be used in a similar fashion to rpcauth_create() when a
      client is hunting for the correct security flavor.  Instead of
      replacing an rpc_clnt's security flavor in a loop, the ULP replaces
      the whole rpc_clnt.
      
      To fix the -EEXIST problem, any ULP logic that relies on replacing
      an rpc_clnt's rpc_auth with rpcauth_create() must be changed to use
      this API instead.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      ba9b584c
  5. 17 8月, 2012 1 次提交
  6. 31 7月, 2012 5 次提交
  7. 18 7月, 2012 3 次提交
  8. 29 6月, 2012 4 次提交
  9. 18 6月, 2012 1 次提交
    • T
      NFSv4.1: Fix umount when filelayout DS is also the MDS · 2a4c8994
      Trond Myklebust 提交于
      Currently there is a 'chicken and egg' issue when the DS is also the mounted
      MDS. The nfs_match_client() reference from nfs4_set_ds_client bumps the
      cl_count, the nfs_client is not freed at umount, and nfs4_deviceid_purge_client
      is not called to dereference the MDS usage of a deviceid which holds a
      reference to the DS nfs_client.  The result is the umount program returns,
      but the nfs_client is not freed, and the cl_session hearbeat continues.
      
      The MDS (and all other nfs mounts) lose their last nfs_client reference in
      nfs_free_server when the last nfs_server (fsid) is umounted.
      The file layout DS lose their last nfs_client reference in destroy_ds
      when the last deviceid referencing the data server is put and destroy_ds is
      called. This is triggered by a call to nfs4_deviceid_purge_client which
      removes references to a pNFS deviceid used by an MDS mount.
      
      The fix is to track how many pnfs enabled filesystems are mounted from
      this server, and then to purge the device id cache once that count reaches
      zero.
      Reported-by: NJorge Mora <Jorge.Mora@netapp.com>
      Reported-by: NAndy Adamson <andros@netapp.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      2a4c8994
  10. 07 6月, 2012 1 次提交
  11. 27 5月, 2012 1 次提交
  12. 24 5月, 2012 3 次提交
  13. 23 5月, 2012 8 次提交
    • C
      NFS: EXCHANGE_ID should save the server major and minor ID · acdeb69d
      Chuck Lever 提交于
      Save the server major and minor ID results from EXCHANGE_ID, as they
      are needed for detecting server trunking.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      acdeb69d
    • C
      NFS: Add nfs_client behavior flags · 4bf590e0
      Chuck Lever 提交于
      "noresvport" and "discrtry" can be passed to nfs_create_rpc_client()
      by setting flags in the passed-in nfs_client.  This change makes it
      easy to add new flags.
      
      Note that these settings are now "sticky" over the lifetime of a
      struct nfs_client, and may even be copied when an nfs_client is
      cloned.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      4bf590e0
    • C
      NFS: Refactor nfs_get_client(): initialize nfs_client · 8cab4c39
      Chuck Lever 提交于
      Clean up: Continue to rationalize the locking in nfs_get_client() by
      moving the logic that handles the case where a matching server IP
      address is not found.
      
      When we support server trunking detection, client initialization may
      return a different nfs_client struct than was passed to it.  Change
      the synopsis of the init_client methods to return an nfs_client.
      
      The client initialization logic in nfs_get_client() is not much more
      than a wrapper around ->init_client.  It's simpler to keep the little
      bits of error handling in the version-specific init_client methods.
      
      No behavior change is expected.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      8cab4c39
    • C
      NFS: Refactor nfs_get_client(): add nfs_found_client() · f411703a
      Chuck Lever 提交于
      Clean up: Code that takes and releases nfs_client_lock remains in
      nfs_get_client().  Logic that handles a pre-existing nfs_client is
      moved to a separate function.
      
      No behavior change is expected.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      f411703a
    • C
      NFS: Always use the same SETCLIENTID boot verifier · f092075d
      Chuck Lever 提交于
      Currently our NFS client assigns a unique SETCLIENTID boot verifier
      for each server IP address it knows about.  It's set to CURRENT_TIME
      when the struct nfs_client for that server IP is created.
      
      During the SETCLIENTID operation, our client also presents an
      nfs_client_id4 string to servers, as an identifier on which the server
      can hang all of this client's NFSv4 state.  Our client's
      nfs_client_id4 string is unique for each server IP address.
      
      An NFSv4 server is obligated to wipe all NFSv4 state associated with
      an nfs_client_id4 string when the client presents the same
      nfs_client_id4 string along with a changed SETCLIENTID boot verifier.
      
      When our client unmounts the last of a server's shares, it destroys
      that server's struct nfs_client.  The next time the client mounts that
      NFS server, it creates a fresh struct nfs_client with a fresh boot
      verifier.  On seeing the fresh verifer, the server wipes any previous
      NFSv4 state associated with that nfs_client_id4.
      
      However, NFSv4.1 clients are supposed to present the same
      nfs_client_id4 string to all servers.  And, to support Transparent
      State Migration, the same nfs_client_id4 string should be presented
      to all NFSv4.0 servers so they recognize that migrated state for this
      client belongs with state a server may already have for this client.
      (This is known as the Uniform Client String model).
      
      If the nfs_client_id4 string is the same but the boot verifier changes
      for each server IP address, SETCLIENTID and EXCHANGE_ID operations
      from such a client could unintentionally result in a server wiping a
      client's previously obtained lease.
      
      Thus, if our NFS client is going to use a fixed nfs_client_id4 string,
      either for NFSv4.0 or NFSv4.1 mounts, our NFS client should use a
      boot verifier that does not change depending on server IP address.
      Replace our current per-nfs_client boot verifier with a per-nfs_net
      boot verifier.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      f092075d
    • C
      NFS: Use proper naming conventions for the nfs_client.net field · 73ea666c
      Chuck Lever 提交于
      Clean up:  When naming fields and data types, follow established
      conventions to facilitate accurate grep/cscope searches.
      
      Introduced by commit e50a7a1a "NFS: make NFS client allocated per
      network namespace context," Tue Jan 10, 2012.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      73ea666c
    • C
      NFS: Use proper naming conventions for nfs_client.impl_id field · 59155546
      Chuck Lever 提交于
      Clean up:  When naming fields and data types, follow established
      conventions to facilitate accurate grep/cscope searches.
      
      Additionally, for consistency, move the impl_id field into the NFSv4-
      specific part of the nfs_client, and free that memory in the logic
      that shuts down NFSv4 nfs_clients.
      
      Introduced by commit 7d2ed9ac "NFSv4: parse and display server
      implementation ids," Fri Feb 17, 2012.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      59155546
    • C
      NFS: Use proper naming conventions for NFSv4.1 server scope fields · 79d4e1f0
      Chuck Lever 提交于
      Clean up:  When naming fields and data types, follow established
      conventions to facilitate accurate grep/cscope searches.
      
      Additionally, for consistency, move the scope field into the NFSv4-
      specific part of the nfs_client, and free that memory in the logic
      that shuts down NFSv4 nfs_clients.
      
      Introduced by commit 99fe60d0 "nfs41: exchange_id operation", April
      1 2009.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      79d4e1f0
  14. 20 5月, 2012 1 次提交
  15. 15 5月, 2012 1 次提交
  16. 02 5月, 2012 1 次提交
  17. 28 4月, 2012 1 次提交
  18. 29 3月, 2012 1 次提交