1. 04 9月, 2013 10 次提交
    • C
      NFS: Common versions of sequence helper functions · a9c92d6b
      Chuck Lever 提交于
      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: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      a9c92d6b
    • C
      NFS: Clean up nfs4_setup_sequence() · 5a580e0a
      Chuck Lever 提交于
      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: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      5a580e0a
    • C
      NFS: Rename nfs41_call_sync_data as a common data structure · 2a3eb2b9
      Chuck Lever 提交于
      Clean up: rename nfs41_call_sync_data for use as a data structure
      common to all NFSv4 minor versions.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      2a3eb2b9
    • C
      NFS: When displaying session slot numbers, use "%u" consistently · e8d92382
      Chuck Lever 提交于
      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: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      e8d92382
    • T
      NFS: Ensure that rmdir() waits for sillyrenames to complete · ba6c0592
      Trond Myklebust 提交于
      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: NTrond Myklebust <Trond.Myklebust@netapp.com>
      ba6c0592
    • W
      NFSv4: use the mach cred for SECINFO w/ integrity · a5250def
      Weston Andros Adamson 提交于
      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: NWeston Andros Adamson <dros@netapp.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      a5250def
    • A
      SUNRPC refactor rpcauth_checkverf error returns · 35fa5f7b
      Andy Adamson 提交于
      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: NAndy Adamson <andros@netapp.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      35fa5f7b
    • A
      NFS avoid expired credential keys for buffered writes · dc24826b
      Andy Adamson 提交于
      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: NAndy Adamson <andros@netapp.com>
      [Trond: removed a pr_warn_ratelimited() for now]
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      dc24826b
    • A
      SUNRPC new rpc_credops to test credential expiry · 4de6caa2
      Andy Adamson 提交于
      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: NAndy Adamson <andros@netapp.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      4de6caa2
    • A
      SUNRPC: don't map EKEYEXPIRED to EACCES in call_refreshresult · f1ff0c27
      Andy Adamson 提交于
      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: NAndy Adamson <andros@netapp.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      f1ff0c27
  2. 03 9月, 2013 2 次提交
  3. 01 9月, 2013 6 次提交
  4. 30 8月, 2013 10 次提交
  5. 23 8月, 2013 1 次提交
    • N
      NFS: remove incorrect "Lock reclaim failed!" warning. · 6686390b
      NeilBrown 提交于
      After reclaiming state that was lost, the NFS client tries to reclaim
      any locks, and then checks that each one has NFS_LOCK_INITIALIZED set
      (which means that the server has confirmed the lock).
      However if the client holds a delegation, nfs_reclaim_locks() simply aborts
      (or more accurately it called nfs_lock_reclaim() and that returns without
      doing anything).
      
      This is because when a delegation is held, the server doesn't need to
      know about locks.
      
      So if a delegation is held, NFS_LOCK_INITIALIZED is not expected, and
      its absence is certainly not an error.
      
      So don't print the warnings if NFS_DELGATED_STATE is set.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      6686390b
  6. 22 8月, 2013 11 次提交