20 Jan, 2021

2 commits

  • commit 46c9ea1d4fee4cf1f8cc6001b9c14aae61b3d502 upstream.

    We must ensure that we pass a layout segment to nfs_retry_commit() when
    we're cleaning up after pnfs_bucket_alloc_ds_commits(). Otherwise,
    requests that should be committed to the DS will get committed to the
    MDS.
    Do so by ensuring that pnfs_bucket_get_committing() always tries to
    return a layout segment when it returns a non-empty page list.

    Fixes: c84bea59449a ("NFS/pNFS: Simplify bucket layout segment reference counting")
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     
  • commit 1757655d780d9d29bc4b60e708342e94924f7ef3 upstream.

    In pnfs_generic_clear_request_commit(), we try calling
    pnfs_free_bucket_lseg() before we remove the request from the DS bucket.
    That will always fail, since the point is to test for whether or not
    that bucket is empty.

    Fixes: c84bea59449a ("NFS/pNFS: Simplify bucket layout segment reference counting")
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     

13 May, 2020

1 commit


11 Apr, 2020

1 commit

  • Another brown paper bag moment. pnfs_alloc_ds_commits_list() is leaking
    the RCU lock.

    Fixes: a9901899b649 ("pNFS: Add infrastructure for cleaning up per-layout commit structures")
    Signed-off-by: Trond Myklebust

    Trond Myklebust
     

28 Mar, 2020

10 commits


26 Mar, 2020

2 commits


15 Jan, 2020

1 commit


27 Aug, 2019

1 commit

  • The pNFS/flexfiles I/O requests are sent with the SOFTCONN flag set, so
    they automatically time out if the connection breaks. It should
    therefore not be necessary to have the soft flag set in addition.

    Fixes: 5f01d9539496 ("nfs41: create NFSv3 DS connection if specified")
    Signed-off-by: Trond Myklebust

    Trond Myklebust
     

21 May, 2019

1 commit

  • Add SPDX license identifiers to all files which:

    - Have no license information of any form

    - Have EXPORT_.*_SYMBOL_GPL inside which was used in the
    initial scan/conversion to ignore the file

    These files fall under the project license, GPL v2 only. The resulting SPDX
    license identifier is:

    GPL-2.0-only

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

20 Dec, 2018

1 commit

  • SUNRPC has two sorts of credentials, both of which appear as
    "struct rpc_cred".
    There are "generic credentials" which are supplied by clients
    such as NFS and passed in 'struct rpc_message' to indicate
    which user should be used to authorize the request, and there
    are low-level credentials such as AUTH_NULL, AUTH_UNIX, AUTH_GSS
    which describe the credential to be sent over the wires.

    This patch replaces all the generic credentials by 'struct cred'
    pointers - the credential structure used throughout Linux.

    For machine credentials, there is a special 'struct cred *' pointer
    which is statically allocated and recognized where needed as
    having a special meaning. A look-up of a low-level cred will
    map this to a machine credential.

    Signed-off-by: NeilBrown
    Acked-by: J. Bruce Fields
    Signed-off-by: Anna Schumaker

    NeilBrown
     

15 Aug, 2018

1 commit

  • The use of the inode->i_lock was converted to a mutex, but we forgot
    to remove the old inode unlock/lock() pair that allowed the layout
    segment to be put inside the loop.

    Reported-by: Jia-Ju Bai
    Fixes: e824f99adaaf1 ("NFSv4: Use a mutex to protect the per-inode commit...")
    Cc: stable@vger.kernel.org # v4.14+
    Signed-off-by: Trond Myklebust
    Signed-off-by: Anna Schumaker

    Trond Myklebust
     

20 Mar, 2018

1 commit


18 Nov, 2017

1 commit

  • atomic_t variables are currently used to implement reference
    counters with the following properties:
    - counter is initialized to 1 using atomic_set()
    - a resource is freed upon counter reaching zero
    - once counter reaches zero, its further
    increments aren't allowed
    - counter schema uses basic atomic operations
    (set, inc, inc_not_zero, dec_and_test, etc.)

    Such atomic variables should be converted to a newly provided
    refcount_t type and API that prevents accidental counter overflows
    and underflows. This is important since overflows and underflows
    can lead to use-after-free situation and be exploitable.

    The variable nfs4_pnfs_ds.ds_count is used as pure reference counter.
    Convert it to refcount_t and fix up the operations.

    Suggested-by: Kees Cook
    Reviewed-by: David Windsor
    Reviewed-by: Hans Liljestrand
    Signed-off-by: Elena Reshetova
    Signed-off-by: Anna Schumaker

    Elena Reshetova
     

10 Sep, 2017

2 commits


15 Aug, 2017

3 commits


20 Jul, 2017

3 commits


04 May, 2017

1 commit


03 May, 2017

1 commit


29 Apr, 2017

1 commit


21 Apr, 2017

2 commits

  • It is not used outside the NFSv4 module.

    Signed-off-by: Trond Myklebust

    Trond Myklebust
     
  • When passed GFP flags that allow sleeping (such as
    GFP_NOIO), mempool_alloc() will never return NULL, it will
    wait until memory is available.

    This means that we don't need to handle failure, but that we
    do need to ensure one thread doesn't call mempool_alloc()
    twice on the one pool without queuing or freeing the first
    allocation. If multiple threads did this during times of
    high memory pressure, the pool could be exhausted and a
    deadlock could result.

    pnfs_generic_alloc_ds_commits() attempts to allocate from
    the nfs_commit_mempool while already holding an allocation
    from that pool. This is not safe. So change
    nfs_commitdata_alloc() to take a flag that indicates whether
    failure is acceptable.

    In pnfs_generic_alloc_ds_commits(), accept failure and
    handle it as we currently do. Else where, do not accept
    failure, and do not handle it.

    Even when failure is acceptable, we want to succeed if
    possible. That means both
    - using an entry from the pool if there is one
    - waiting for direct reclaim is there isn't.

    We call mempool_alloc(GFP_NOWAIT) to achieve the first, then
    kmem_cache_alloc(GFP_NOIO|__GFP_NORETRY) to achieve the
    second. Each of these can fail, but together they do the
    best they can without blocking indefinitely.

    The objects returned by kmem_cache_alloc() will still be freed
    by mempool_free(). This is safe as mempool_alloc() uses
    exactly the same function to allocate objects (since the mempool
    was created with mempool_create_slab_pool()). The object returned
    by mempool_alloc() and kmem_cache_alloc() are indistinguishable
    so mempool_free() will handle both identically, either adding to the
    pool or calling kmem_cache_free().

    Also, don't test for failure when allocating from
    nfs_wdata_mempool.

    Signed-off-by: NeilBrown
    Signed-off-by: Trond Myklebust

    NeilBrown
     

18 Mar, 2017

2 commits

  • The flexfiles layout should never mark a device unavailable.

    Move nfs4_mark_deviceid_unavailable out of nfs4_pnfs_ds_connect and call
    directly from files layout where it's still needed.

    The flexfiles driver still handles marked devices in error paths, but will
    now print a rate limited warning.

    Signed-off-by: Weston Andros Adamson
    Signed-off-by: Anna Schumaker

    Weston Andros Adamson
     
  • The nfs4_pnfs_ds_connect path can call rpc_create which can fail or it
    can wait on another context to reach the same failure.

    This checks that the rpc_create succeeded and returns the error to the
    caller.

    When an error is returned, both the files and flexfiles layouts will return
    NULL from _prepare_ds(). The flexfiles layout will also return the layout
    with the error NFS4ERR_NXIO.

    Signed-off-by: Weston Andros Adamson
    Signed-off-by: Anna Schumaker

    Weston Andros Adamson
     

02 Dec, 2016

1 commit


20 Sep, 2016

1 commit

  • Try all multipath addresses for a data server. The first address that
    successfully connects and creates a session is the DS mount address.
    All subsequent addresses are tested for session trunking and
    added as aliases.

    Signed-off-by: Andy Adamson
    Signed-off-by: Anna Schumaker

    Andy Adamson