lkml.org 
[lkml]   [2016]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.6 052/203] pnfs_nfs: fix _cancel_empty_pagelist
    Date
    4.6-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Weston Andros Adamson <dros@monkey.org>

    commit 5e3a98883e7ebdd1440f829a9e9dd5c3d2c5903b upstream.

    pnfs_generic_commit_cancel_empty_pagelist calls nfs_commitdata_release,
    but that is wrong: nfs_commitdata_release puts the open context, something
    that isn't valid until nfs_init_commit is called, which is never the case
    when pnfs_generic_commit_cancel_empty_pagelist is called.

    This was introduced in "nfs: avoid race that crashes nfs_init_commit".

    Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
    Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
    Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    fs/nfs/pnfs_nfs.c | 12 ++++++++++--
    1 file changed, 10 insertions(+), 2 deletions(-)

    --- a/fs/nfs/pnfs_nfs.c
    +++ b/fs/nfs/pnfs_nfs.c
    @@ -247,7 +247,11 @@ void pnfs_fetch_commit_bucket_list(struc
    }

    /* Helper function for pnfs_generic_commit_pagelist to catch an empty
    - * page list. This can happen when two commits race. */
    + * page list. This can happen when two commits race.
    + *
    + * This must be called instead of nfs_init_commit - call one or the other, but
    + * not both!
    + */
    static bool
    pnfs_generic_commit_cancel_empty_pagelist(struct list_head *pages,
    struct nfs_commit_data *data,
    @@ -256,7 +260,11 @@ pnfs_generic_commit_cancel_empty_pagelis
    if (list_empty(pages)) {
    if (atomic_dec_and_test(&cinfo->mds->rpcs_out))
    wake_up_atomic_t(&cinfo->mds->rpcs_out);
    - nfs_commitdata_release(data);
    + /* don't call nfs_commitdata_release - it tries to put
    + * the open_context which is not acquired until nfs_init_commit
    + * which has not been called on @data */
    + WARN_ON_ONCE(data->context);
    + nfs_commit_free(data);
    return true;
    }


    \
     
     \ /
      Last update: 2016-07-26 01:01    [W:4.138 / U:0.192 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site