01 Feb, 2017

2 commits

  • commit a430607b2ef7c3be090f88c71cfcb1b3988aa7c0 upstream.

    Some nfsv4.0 servers may return a mode for the verifier following an open
    with EXCLUSIVE4 createmode, but this does not mean the client should skip
    setting the mode in the following SETATTR. It should only do that for
    EXCLUSIVE4_1 or UNGAURDED createmode.

    Fixes: 5334c5bdac92 ("NFS: Send attributes in OPEN request for NFS4_CREATE_EXCLUSIVE4_1")
    Signed-off-by: Benjamin Coddington
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Benjamin Coddington
     
  • commit 8ac092519ad91931c96d306c4bfae2c6587c325f upstream.

    We cannot call nfs4_handle_exception() without first ensuring that the
    slot has been freed. If not, we end up deadlocking with the process
    waiting for recovery to complete, and recovery waiting for the slot
    table to drain.

    Fixes: 2e80dbe7ac51 ("NFSv4.1: Close callback races for OPEN, LAYOUTGET...")
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     

24 Nov, 2016

1 commit

  • Pull NFS client bugfixes from Anna Schumaker:
    "Most of these fix regressions or races, but there is one patch for
    stable that Arnd sent me

    Stable bugfix:
    - Hide array-bounds warning

    Bugfixes:
    - Keep a reference on lock states while checking
    - Handle NFS4ERR_OLD_STATEID in nfs4_reclaim_open_state
    - Don't call close if the open stateid has already been cleared
    - Fix CLOSE rases with OPEN
    - Fix a regression in DELEGRETURN"

    * tag 'nfs-for-4.9-4' of git://git.linux-nfs.org/projects/anna/linux-nfs:
    NFSv4.x: hide array-bounds warning
    NFSv4.1: Keep a reference on lock states while checking
    NFSv4.1: Handle NFS4ERR_OLD_STATEID in nfs4_reclaim_open_state
    NFSv4: Don't call close if the open stateid has already been cleared
    NFSv4: Fix CLOSE races with OPEN
    NFSv4.1: Fix a regression in DELEGRETURN

    Linus Torvalds
     

22 Nov, 2016

1 commit


19 Nov, 2016

3 commits

  • Ensure we test to see if the open stateid is actually set, before we
    send a CLOSE.

    Signed-off-by: Trond Myklebust
    Signed-off-by: Anna Schumaker

    Trond Myklebust
     
  • If the reply to a successful CLOSE call races with an OPEN to the same
    file, we can end up scribbling over the stateid that represents the
    new open state.
    The race looks like:

    Client Server
    ====== ======

    CLOSE stateid A on file "foo"
    CLOSE stateid A, return stateid C
    OPEN file "foo"
    OPEN "foo", return stateid B
    Receive reply to OPEN
    Reset open state for "foo"
    Associate stateid B to "foo"

    Receive CLOSE for A
    Reset open state for "foo"
    Replace stateid B with C

    The fix is to examine the argument of the CLOSE, and check for a match
    with the current stateid "other" field. If the two do not match, then
    the above race occurred, and we should just ignore the CLOSE.

    Reported-by: Benjamin Coddington
    Signed-off-by: Trond Myklebust
    Signed-off-by: Anna Schumaker

    Trond Myklebust
     
  • We don't want to call nfs4_free_revoked_stateid() in the case where
    the delegreturn was successful.

    Reported-by: Benjamin Coddington
    Signed-off-by: Trond Myklebust
    Signed-off-by: Anna Schumaker

    Trond Myklebust
     

22 Oct, 2016

1 commit


20 Oct, 2016

1 commit

  • A bugfix introduced a harmless warning for update_open_stateid:

    fs/nfs/nfs4proc.c:1548:2: error: missing braces around initializer [-Werror=missing-braces]

    Removing the zero in the initializer will do the right thing here
    and initialize the entire structure to zero.

    Fixes: 1393d9612ba0 ("NFSv4: Fix a race when updating an open_stateid")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Anna Schumaker

    Arnd Bergmann
     

14 Oct, 2016

1 commit

  • Pull NFS client updates from Anna Schumaker:
    "Highlights include:

    Stable bugfixes:
    - sunrpc: fix writ espace race causing stalls
    - NFS: Fix inode corruption in nfs_prime_dcache()
    - NFSv4: Don't report revoked delegations as valid in nfs_have_delegation()
    - NFSv4: nfs4_copy_delegation_stateid() must fail if the delegation is invalid
    - NFSv4: Open state recovery must account for file permission changes
    - NFSv4.2: Fix a reference leak in nfs42_proc_layoutstats_generic

    Features:
    - Add support for tracking multiple layout types with an ordered list
    - Add support for using multiple backchannel threads on the client
    - Add support for pNFS file layout session trunking
    - Delay xprtrdma use of DMA API (for device driver removal)
    - Add support for xprtrdma remote invalidation
    - Add support for larger xprtrdma inline thresholds
    - Use a scatter/gather list for sending xprtrdma RPC calls
    - Add support for the CB_NOTIFY_LOCK callback
    - Improve hashing sunrpc auth_creds by using both uid and gid

    Bugfixes:
    - Fix xprtrdma use of DMA API
    - Validate filenames before adding to the dcache
    - Fix corruption of xdr->nwords in xdr_copy_to_scratch
    - Fix setting buffer length in xdr_set_next_buffer()
    - Don't deadlock the state manager on the SEQUENCE status flags
    - Various delegation and stateid related fixes
    - Retry operations if an interrupted slot receives EREMOTEIO
    - Make nfs boot time y2038 safe"

    * tag 'nfs-for-4.9-1' of git://git.linux-nfs.org/projects/anna/linux-nfs: (100 commits)
    NFSv4.2: Fix a reference leak in nfs42_proc_layoutstats_generic
    fs: nfs: Make nfs boot time y2038 safe
    sunrpc: replace generic auth_cred hash with auth-specific function
    sunrpc: add RPCSEC_GSS hash_cred() function
    sunrpc: add auth_unix hash_cred() function
    sunrpc: add generic_auth hash_cred() function
    sunrpc: add hash_cred() function to rpc_authops struct
    Retry operation on EREMOTEIO on an interrupted slot
    pNFS: Fix atime updates on pNFS clients
    sunrpc: queue work on system_power_efficient_wq
    NFSv4.1: Even if the stateid is OK, we may need to recover the open modes
    NFSv4: If recovery failed for a specific open stateid, then don't retry
    NFSv4: Fix retry issues with nfs41_test/free_stateid
    NFSv4: Open state recovery must account for file permission changes
    NFSv4: Mark the lock and open stateids as invalid after freeing them
    NFSv4: Don't test open_stateid unless it is set
    NFSv4: nfs4_do_handle_exception() handle revoke/expiry of a single stateid
    NFS: Always call nfs_inode_find_state_and_recover() when revoking a delegation
    NFSv4: Fix a race when updating an open_stateid
    NFSv4: Fix a race in nfs_inode_reclaim_delegation()
    ...

    Linus Torvalds
     

08 Oct, 2016

1 commit


05 Oct, 2016

1 commit

  • boot_time is represented as a struct timespec.
    struct timespec and CURRENT_TIME are not y2038 safe.
    Overall, the plan is to use timespec64 and ktime_t for
    all internal kernel representation of timestamps.
    CURRENT_TIME will also be removed.

    boot_time is used to construct the nfs client boot verifier.

    Use ktime_t to represent boot_time and ktime_get_real() for
    the boot_time value.

    Following Trond's request https://lkml.org/lkml/2016/6/9/22 ,
    use ktime_t instead of converting to struct timespec64.

    Use higher and lower 32 bit parts of ktime_t for the boot
    verifier.

    Use the lower 32 bit part of ktime_t for the authsys_parms
    stamp field.

    Signed-off-by: Deepa Dinamani
    Reviewed-by: Arnd Bergmann
    Cc: Trond Myklebust
    Cc: Anna Schumaker
    Cc: linux-nfs@vger.kernel.org
    Signed-off-by: Anna Schumaker

    Deepa Dinamani
     

30 Sep, 2016

1 commit


28 Sep, 2016

22 commits


23 Sep, 2016

5 commits

  • Add a waitqueue head to the client structure. Have clients set a wait
    on that queue prior to requesting a lock from the server. If the lock
    is blocked, then we can use that to wait for wakeups.

    Note that we do need to do this "manually" since we need to set the
    wait on the waitqueue prior to requesting the lock, but requesting a
    lock can involve activities that can block.

    However, only do that for NFSv4.1 locks, either by compiling out
    all of the waitqueue handling when CONFIG_NFS_V4_1 is disabled, or
    skipping all of it at runtime if we're dealing with v4.0, or v4.1
    servers that don't send lock callbacks.

    Note too that even when we expect to get a lock callback, RFC5661
    section 20.11.4 is pretty clear that we still need to poll for them,
    so we do still sleep on a timeout. We do however always poll at the
    longest interval in that case.

    Signed-off-by: Jeff Layton
    [Anna: nfs4_retry_setlk() "status" should default to -ERESTARTSYS]
    Signed-off-by: Anna Schumaker

    Jeff Layton
     
  • This also consolidates the waiting logic into a single function,
    instead of having it spread across two like it is now.

    Signed-off-by: Jeff Layton
    Signed-off-by: Anna Schumaker

    Jeff Layton
     
  • We need to have this info set up before adding the waiter to the
    waitqueue, so move this out of the _nfs4_proc_setlk and into the
    caller. That's more efficient anyway since we don't need to do
    this more than once if we end up waiting on the lock.

    Signed-off-by: Jeff Layton
    Signed-off-by: Anna Schumaker

    Jeff Layton
     
  • We want to handle the two cases differently, such that we poll more
    aggressively when we don't expect a callback.

    Signed-off-by: Jeff Layton
    Signed-off-by: Anna Schumaker

    Jeff Layton
     
  • We actually want to use TASK_INTERRUPTIBLE sleeps when we're in the
    process of polling for a NFSv4 lock. If there is a signal pending when
    the task wakes up, then we'll be returning an error anyway. So, we might
    as well wake up immediately for non-fatal signals as well. That allows
    us to return to userland more quickly in that case, but won't change the
    error that userland sees.

    Also, there is no need to use the *_unsafe sleep variants here, as no
    vfs-layer locks should be held at this point.

    Signed-off-by: Jeff Layton
    Signed-off-by: Anna Schumaker

    Jeff Layton