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
     

20 Jan, 2017

4 commits

  • commit cfd278c280f997cf2fe4662e0acab0fe465f637b upstream.

    Various places assume that if nfs4_fl_prepare_ds() turns a non-NULL 'ds',
    then ds->ds_clp will also be non-NULL.

    This is not necessasrily true in the case when the process received a fatal signal
    while nfs4_pnfs_ds_connect is waiting in nfs4_wait_ds_connect().
    In that case ->ds_clp may not be set, and the devid may not recently have been marked
    unavailable.

    So add a test for ds_clp == NULL and return NULL in that case.

    Fixes: c23266d532b4 ("NFS4.1 Fix data server connection race")
    Signed-off-by: NeilBrown
    Acked-by: Olga Kornievskaia
    Acked-by: Adamson, Andy
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    NeilBrown
     
  • commit 79f687a3de9e3ba2518b4ea33f38ca6cbe9133eb upstream.

    Ben Coddington reports that commit 311324ad1713, by adding the function
    nfs_dir_mapping_need_revalidate() that checks page cache validity on
    each call to nfs_readdir() causes a performance regression when
    the directory is being modified.

    If the directory is changing while we're iterating through the directory,
    POSIX does not require us to invalidate the page cache unless the user
    calls rewinddir(). However, we still do want to ensure that we use
    readdirplus in order to avoid a load of stat() calls when the user
    is doing an 'ls -l' workload.

    The fix should be to invalidate the page cache immediately when we're
    setting the NFS_INO_ADVISE_RDPLUS bit.

    Reported-by: Benjamin Coddington
    Fixes: 311324ad1713 ("NFS: Be more aggressive in using readdirplus...")
    Reviewed-by: Benjamin Coddington
    Tested-by: Benjamin Coddington
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     
  • commit ee284e35d8c71bf5d4d807eaff6f67a17134b359 upstream.

    We must put the task to sleep while holding the inode->i_lock in order
    to ensure atomicity with the test for NFS_LAYOUT_RETURN.

    Fixes: 500d701f336b ("NFS41: make close wait for layoutreturn")
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     
  • commit f36ab161bebe464d33b998294eff29b17a9c8918 upstream.

    Fix typo in parameter description.

    Fixes: 5405fc44c337 ("NFSv4.x: Add kernel parameter to control the
    callback server")
    Signed-off-by: Wei Yongjun
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Wei Yongjun
     

09 Jan, 2017

5 commits


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
     

23 Nov, 2016

1 commit

  • A correct bugfix introduced a harmless warning that shows up with gcc-7:

    fs/nfs/callback.c: In function 'nfs_callback_up':
    fs/nfs/callback.c:214:14: error: array subscript is outside array bounds [-Werror=array-bounds]

    What happens here is that the 'minorversion == 0' check tells the
    compiler that we assume minorversion can be something other than 0,
    but when CONFIG_NFS_V4_1 is disabled that would be invalid and
    result in an out-of-bounds access.

    The added check for IS_ENABLED(CONFIG_NFS_V4_1) tells gcc that this
    really can't happen, which makes the code slightly smaller and also
    avoids the warning.

    The bugfix that introduced the warning is marked for stable backports,
    we want this one backported to the same releases.

    Fixes: 98b0f80c2396 ("NFSv4.x: Fix a refcount leak in nfs_callback_up_net")
    Cc: stable@vger.kernel.org # v3.7+
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Anna Schumaker

    Arnd Bergmann
     

22 Nov, 2016

1 commit


19 Nov, 2016

4 commits

  • Now that we're doing TEST_STATEID in nfs4_reclaim_open_state(), we can have
    a NFS4ERR_OLD_STATEID returned from nfs41_open_expired() . Instead of
    marking state recovery as failed, mark the state for recovery again.

    Signed-off-by: Benjamin Coddington
    Signed-off-by: Anna Schumaker

    Benjamin Coddington
     
  • 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
     

12 Nov, 2016

1 commit

  • Pull NFS client bugfixes from Anna Schumaker:
    "Most of these fix regressions in 4.9, and none are going to stable
    this time around.

    Bugfixes:
    - Trim extra slashes in v4 nfs_paths to fix tools that use this
    - Fix a -Wmaybe-uninitialized warnings
    - Fix suspicious RCU usages
    - Fix Oops when mounting multiple servers at once
    - Suppress a false-positive pNFS error
    - Fix a DMAR failure in NFS over RDMA"

    * tag 'nfs-for-4.9-3' of git://git.linux-nfs.org/projects/anna/linux-nfs:
    xprtrdma: Fix DMAR failure in frwr_op_map() after reconnect
    fs/nfs: Fix used uninitialized warn in nfs4_slot_seqid_in_use()
    NFS: Don't print a pNFS error if we aren't using pNFS
    NFS: Ignore connections that have cl_rpcclient uninitialized
    SUNRPC: Fix suspicious RCU usage
    NFSv4.1: work around -Wmaybe-uninitialized warning
    NFS: Trim extra slash in v4 nfs_path

    Linus Torvalds
     

08 Nov, 2016

3 commits

  • Fix the following warn:

    fs/nfs/nfs4session.c: In function ‘nfs4_slot_seqid_in_use’:
    fs/nfs/nfs4session.c:203:54: warning: ‘cur_seq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    if (nfs4_slot_get_seqid(tbl, slotid, &cur_seq) == 0 &&
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
    cur_seq == seq_nr && test_bit(slotid, tbl->used_slots))
    ~~~~~~~~~~~~~~~~~

    Signed-off-by: Shuah Khan
    Signed-off-by: Anna Schumaker

    Shuah Khan
     
  • We used to check for a valid layout type id before verifying pNFS flags
    as an indicator for if we are using pNFS. This changed in 3132e49ece
    with the introduction of multiple layout types, since now we are passing
    an array of ids instead of just one. Since then, users have been seeing
    a KERN_ERR printk show up whenever mounting NFS v4 without pNFS. This
    patch restores the original behavior of exiting set_pnfs_layoutdriver()
    early if we aren't using pNFS.

    Fixes 3132e49ece ("pnfs: track multiple layout types in fsinfo
    structure")
    Reviewed-by: Jeff Layton
    Signed-off-by: Anna Schumaker

    Anna Schumaker
     
  • cl_rpcclient starts as ERR_PTR(-EINVAL), and connections like that
    are floating freely through the system. Most places check whether
    pointer is valid before dereferencing it, but newly added code
    in nfs_match_client does not.

    Which causes crashes when more than one NFS mount point is present.

    Signed-off-by: Petr Vandrovec
    Signed-off-by: Anna Schumaker

    Petr Vandrovec
     

25 Oct, 2016

2 commits

  • A bugfix introduced a harmless gcc warning in nfs4_slot_seqid_in_use
    if we enable -Wmaybe-uninitialized again:

    fs/nfs/nfs4session.c:203:54: error: 'cur_seq' may be used uninitialized in this function [-Werror=maybe-uninitialized]

    gcc is not smart enough to conclude that the IS_ERR/PTR_ERR pair
    results in a nonzero return value here. Using PTR_ERR_OR_ZERO()
    instead makes this clear to the compiler.

    The warning originally did not appear in v4.8 as it was globally
    disabled, but the bugfix that introduced the warning got backported
    to stable kernels which again enable it, and this is now the only
    warning in the v4.7 builds.

    Fixes: e09c978aae5b ("NFSv4.1: Fix Oopsable condition in server callback races")
    Signed-off-by: Arnd Bergmann
    Cc: Trond Myklebust
    Signed-off-by: Anna Schumaker

    Arnd Bergmann
     
  • A NFSv4 mount of a subdirectory will show an extra slash (as in
    'server://path') in proc's mountinfo which will not match the device name
    and path. This can cause problems for programs searching for the mount.
    Fix this by checking for a leading slash in the dentry path, if so trim
    away any trailing slashes in the device name.

    Signed-off-by: Benjamin Coddington
    Signed-off-by: Anna Schumaker

    Benjamin Coddington
     

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

2 commits

  • 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
     
  • Commit 41963c10c47a35185e68cb9049f7a3493c94d2d7 sets the block layout's
    last written byte to the offset of the end of the extent rather than the
    end of the write which incorrectly updates the inode's size for
    partial-page writes.

    Fixes: 41963c10c47a ("pnfs/blocklayout: update last_write_offset atomically with extents")
    Signed-off-by: Benjamin Coddington
    Reviewed-by: Christoph Hellwig
    Tested-by: Christoph Hellwig
    Cc: stable@vger.kernel.org # 4.8+
    Signed-off-by: Anna Schumaker

    Benjamin Coddington
     

11 Oct, 2016

2 commits

  • Pull more vfs updates from Al Viro:
    ">rename2() work from Miklos + current_time() from Deepa"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs: Replace current_fs_time() with current_time()
    fs: Replace CURRENT_TIME_SEC with current_time() for inode timestamps
    fs: Replace CURRENT_TIME with current_time() for inode timestamps
    fs: proc: Delete inode time initializations in proc_alloc_inode()
    vfs: Add current_time() api
    vfs: add note about i_op->rename changes to porting
    fs: rename "rename2" i_op to "rename"
    vfs: remove unused i_op->rename
    fs: make remaining filesystems use .rename2
    libfs: support RENAME_NOREPLACE in simple_rename()
    fs: support RENAME_NOREPLACE for local filesystems
    ncpfs: fix unused variable warning

    Linus Torvalds
     
  • Pull vfs xattr updates from Al Viro:
    "xattr stuff from Andreas

    This completes the switch to xattr_handler ->get()/->set() from
    ->getxattr/->setxattr/->removexattr"

    * 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    vfs: Remove {get,set,remove}xattr inode operations
    xattr: Stop calling {get,set,remove}xattr inode operations
    vfs: Check for the IOP_XATTR flag in listxattr
    xattr: Add __vfs_{get,set,remove}xattr helpers
    libfs: Use IOP_XATTR flag for empty directory handling
    vfs: Use IOP_XATTR flag for bad-inode handling
    vfs: Add IOP_XATTR inode operations flag
    vfs: Move xattr_resolve_name to the front of fs/xattr.c
    ecryptfs: Switch to generic xattr handlers
    sockfs: Get rid of getxattr iop
    sockfs: getxattr: Fail with -EOPNOTSUPP for invalid attribute names
    kernfs: Switch to generic xattr handlers
    hfs: Switch to generic xattr handlers
    jffs2: Remove jffs2_{get,set,remove}xattr macros
    xattr: Remove unnecessary NULL attribute name check

    Linus Torvalds
     

08 Oct, 2016

3 commits

  • Merge updates from Andrew Morton:

    - fsnotify updates

    - ocfs2 updates

    - all of MM

    * emailed patches from Andrew Morton : (127 commits)
    console: don't prefer first registered if DT specifies stdout-path
    cred: simpler, 1D supplementary groups
    CREDITS: update Pavel's information, add GPG key, remove snail mail address
    mailmap: add Johan Hovold
    .gitattributes: set git diff driver for C source code files
    uprobes: remove function declarations from arch/{mips,s390}
    spelling.txt: "modeled" is spelt correctly
    nmi_backtrace: generate one-line reports for idle cpus
    arch/tile: adopt the new nmi_backtrace framework
    nmi_backtrace: do a local dump_stack() instead of a self-NMI
    nmi_backtrace: add more trigger_*_cpu_backtrace() methods
    min/max: remove sparse warnings when they're nested
    Documentation/filesystems/proc.txt: add more description for maps/smaps
    mm, proc: fix region lost in /proc/self/smaps
    proc: fix timerslack_ns CAP_SYS_NICE check when adjusting self
    proc: add LSM hook checks to /proc//timerslack_ns
    proc: relax /proc//timerslack_ns capability requirements
    meminfo: break apart a very long seq_printf with #ifdefs
    seq/proc: modify seq_put_decimal_[u]ll to take a const char *, not char
    proc: faster /proc/*/status
    ...

    Linus Torvalds
     
  • These inode operations are no longer used; remove them.

    Signed-off-by: Andreas Gruenbacher
    Signed-off-by: Al Viro

    Andreas Gruenbacher
     
  • After using the offset of the swap entry as the key of the swap cache,
    the page_index() becomes exactly same as page_file_index(). So the
    page_file_index() is removed and the callers are changed to use
    page_index() instead.

    Link: http://lkml.kernel.org/r/1473270649-27229-2-git-send-email-ying.huang@intel.com
    Signed-off-by: "Huang, Ying"
    Cc: Trond Myklebust
    Cc: Anna Schumaker
    Cc: "Kirill A. Shutemov"
    Cc: Michal Hocko
    Cc: Dave Hansen
    Cc: Johannes Weiner
    Cc: Dan Williams
    Cc: Joonsoo Kim
    Cc: Ross Zwisler
    Cc: Eric Dumazet
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Huang Ying
     

06 Oct, 2016

1 commit


05 Oct, 2016

2 commits

  • The caller of rpc_run_task also gets a reference that must be put.

    Signed-off-by: Jeff Layton
    Cc: stable@vger.kernel.org # 4.2+
    Signed-off-by: Trond Myklebust
    Signed-off-by: Anna Schumaker

    Jeff Layton
     
  • 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

3 commits