1. 03 Sep, 2013 12 commits
    • Chuck Lever's avatar
      220e09cc
    • Chuck Lever's avatar
      NFS: Add RPC callouts to start NFSv4.0 synchronous requests · 9915ea7e
      Chuck Lever authored
      Refactor nfs4_call_sync_sequence() so it is used for NFSv4.0 now.
      The RPC callouts will house transport blocking logic similar to
      NFSv4.1 sessions.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      9915ea7e
    • Chuck Lever's avatar
      NFS: Common versions of sequence helper functions · a9c92d6b
      Chuck Lever authored
      NFSv4.0 will have need for this functionality when I add the ability
      to block NFSv4.0 traffic before migration recovery.
      
      I'm not really clear on why nfs4_set_sequence_privileged() gets a
      generic name, but nfs41_init_sequence() gets a minor
      version-specific name.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      a9c92d6b
    • Chuck Lever's avatar
      NFS: Clean up nfs4_setup_sequence() · 5a580e0a
      Chuck Lever authored
      Clean up: Both the NFSv4.0 and NFSv4.1 version of
      nfs4_setup_sequence() are used only in fs/nfs/nfs4proc.c.  No need
      to keep global header declarations for either version.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      5a580e0a
    • Chuck Lever's avatar
      NFS: Rename nfs41_call_sync_data as a common data structure · 2a3eb2b9
      Chuck Lever authored
      Clean up: rename nfs41_call_sync_data for use as a data structure
      common to all NFSv4 minor versions.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      2a3eb2b9
    • Chuck Lever's avatar
      NFS: When displaying session slot numbers, use "%u" consistently · e8d92382
      Chuck Lever authored
      Clean up, since slot and sequence numbers are all unsigned anyway.
      
      Among other things, squelch compiler warnings:
      
      linux/fs/nfs/nfs4proc.c: In function ‘nfs4_setup_sequence’:
      linux/fs/nfs/nfs4proc.c:703:2: warning: signed and unsigned type in
      	conditional expression [-Wsign-compare]
      
      and
      
      linux/fs/nfs/nfs4session.c: In function ‘nfs4_alloc_slot’:
      linux/fs/nfs/nfs4session.c:151:31: warning: signed and unsigned type in
      	conditional expression [-Wsign-compare]
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      e8d92382
    • Trond Myklebust's avatar
      NFS: Ensure that rmdir() waits for sillyrenames to complete · ba6c0592
      Trond Myklebust authored
      If an NFS client does
      
      	mkdir("dir");
      	fd = open("dir/file");
      	unlink("dir/file");
      	close(fd);
      	rmdir("dir");
      
      then the asynchronous nature of the sillyrename operation means that
      we can end up getting EBUSY for the rmdir() in the above test. Fix
      that by ensuring that we wait for any in-progress sillyrenames
      before sending the rmdir() to the server.
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      ba6c0592
    • Weston Andros Adamson's avatar
      NFSv4: use the mach cred for SECINFO w/ integrity · a5250def
      Weston Andros Adamson authored
      Commit 5ec16a85 introduced a regression
      that causes SECINFO to fail without actualy sending an RPC if:
      
       1) the nfs_client's rpc_client was using KRB5i/p (now tried by default)
       2) the current user doesn't have valid kerberos credentials
      
      This situation is quite common - as of now a sec=sys mount would use
      krb5i for the nfs_client's rpc_client and a user would hardly be faulted
      for not having run kinit.
      
      The solution is to use the machine cred when trying to use an integrity
      protected auth flavor for SECINFO.
      
      Older servers may not support using the machine cred or an integrity
      protected auth flavor for SECINFO in every circumstance, so we fall back
      to using the user's cred and the filesystem's auth flavor in this case.
      
      We run into another problem when running against linux nfs servers -
      they return NFS4ERR_WRONGSEC when using integrity auth flavor (unless the
      mount is also that flavor) even though that is not a valid error for
      SECINFO*.  Even though it's against spec, handle WRONGSEC errors on SECINFO
      by falling back to using the user cred and the filesystem's auth flavor.
      Signed-off-by: default avatarWeston Andros Adamson <dros@netapp.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      a5250def
    • Andy Adamson's avatar
      SUNRPC refactor rpcauth_checkverf error returns · 35fa5f7b
      Andy Adamson authored
      Most of the time an error from the credops crvalidate function means the
      server has sent us a garbage verifier. The gss_validate function is the
      exception where there is an -EACCES case if the user GSS_context on the client
      has expired.
      Signed-off-by: default avatarAndy Adamson <andros@netapp.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      35fa5f7b
    • Andy Adamson's avatar
      NFS avoid expired credential keys for buffered writes · dc24826b
      Andy Adamson authored
      We must avoid buffering a WRITE that is using a credential key (e.g. a GSS
      context key) that is about to expire or has expired.  We currently will
      paint ourselves into a corner by returning success to the applciation
      for such a buffered WRITE, only to discover that we do not have permission when
      we attempt to flush the WRITE (and potentially associated COMMIT) to disk.
      
      Use the RPC layer credential key timeout and expire routines which use a
      a watermark, gss_key_expire_timeo. We test the key in nfs_file_write.
      
      If a WRITE is using a credential with a key that will expire within
      watermark seconds, flush the inode in nfs_write_end and send only
      NFS_FILE_SYNC WRITEs by adding nfs_ctx_key_to_expire to nfs_need_sync_write.
      Note that this results in single page NFS_FILE_SYNC WRITEs.
      Signed-off-by: default avatarAndy Adamson <andros@netapp.com>
      [Trond: removed a pr_warn_ratelimited() for now]
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      dc24826b
    • Andy Adamson's avatar
      SUNRPC new rpc_credops to test credential expiry · 4de6caa2
      Andy Adamson authored
      This patch provides the RPC layer helper functions to allow NFS to manage
      data in the face of expired credentials - such as avoiding buffered WRITEs
      and COMMITs when the gss context will expire before the WRITEs are flushed
      and COMMITs are sent.
      
      These helper functions enable checking the expiration of an underlying
      credential key for a generic rpc credential, e.g. the gss_cred gss context
      gc_expiry which for Kerberos is set to the remaining TGT lifetime.
      
      A new rpc_authops key_timeout is only defined for the generic auth.
      A new rpc_credops crkey_to_expire is only defined for the generic cred.
      A new rpc_credops crkey_timeout is only defined for the gss cred.
      
      Set a credential key expiry watermark, RPC_KEY_EXPIRE_TIMEO set to 240 seconds
      as a default and can be set via a module parameter as we need to ensure there
      is time for any dirty data to be flushed.
      
      If key_timeout is called on a credential with an underlying credential key that
      will expire within watermark seconds, we set the RPC_CRED_KEY_EXPIRE_SOON
      flag in the generic_cred acred so that the NFS layer can clean up prior to
      key expiration.
      
      Checking a generic credential's underlying credential involves a cred lookup.
      To avoid this lookup in the normal case when the underlying credential has
      a key that is valid (before the watermark), a notify flag is set in
      the generic credential the first time the key_timeout is called. The
      generic credential then stops checking the underlying credential key expiry, and
      the underlying credential (gss_cred) match routine then checks the key
      expiration upon each normal use and sets a flag in the associated generic
      credential only when the key expiration is within the watermark.
      This in turn signals the generic credential key_timeout to perform the extra
      credential lookup thereafter.
      Signed-off-by: default avatarAndy Adamson <andros@netapp.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      4de6caa2
    • Andy Adamson's avatar
      SUNRPC: don't map EKEYEXPIRED to EACCES in call_refreshresult · f1ff0c27
      Andy Adamson authored
      The NFS layer needs to know when a key has expired.
      This change also returns -EKEYEXPIRED to the application, and the informative
      "Key has expired" error message is displayed. The user then knows that
      credential renewal is required.
      Signed-off-by: default avatarAndy Adamson <andros@netapp.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      f1ff0c27
  2. 02 Sep, 2013 2 commits
  3. 01 Sep, 2013 6 commits
  4. 30 Aug, 2013 10 commits
  5. 22 Aug, 2013 10 commits