lkml.org 
[lkml]   [2015]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.1 053/159] NFSv4/pnfs: Ensure we dont miss a file extension
    Date
    4.1-stable review patch.  If anyone has any objections, please let me know.

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

    From: Trond Myklebust <trond.myklebust@primarydata.com>

    commit 2b83d3de4c18af49800e0b26ae013db4fcf43a4a upstream.

    pNFS writes don't return attributes, however that doesn't mean that we
    should ignore the fact that they may be extending the file. This patch
    ensures that if a write is seen to extend the file, then we always set
    an attribute barrier, and update the cached file size.

    Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
    Cc: Peng Tao <tao.peng@primarydata.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    fs/nfs/write.c | 15 +++++++++------
    1 file changed, 9 insertions(+), 6 deletions(-)

    --- a/fs/nfs/write.c
    +++ b/fs/nfs/write.c
    @@ -1383,24 +1383,27 @@ static void nfs_writeback_check_extend(s
    {
    struct nfs_pgio_args *argp = &hdr->args;
    struct nfs_pgio_res *resp = &hdr->res;
    + u64 size = argp->offset + resp->count;

    if (!(fattr->valid & NFS_ATTR_FATTR_SIZE))
    + fattr->size = size;
    + if (nfs_size_to_loff_t(fattr->size) < i_size_read(hdr->inode)) {
    + fattr->valid &= ~NFS_ATTR_FATTR_SIZE;
    return;
    - if (argp->offset + resp->count != fattr->size)
    - return;
    - if (nfs_size_to_loff_t(fattr->size) < i_size_read(hdr->inode))
    + }
    + if (size != fattr->size)
    return;
    /* Set attribute barrier */
    nfs_fattr_set_barrier(fattr);
    + /* ...and update size */
    + fattr->valid |= NFS_ATTR_FATTR_SIZE;
    }

    void nfs_writeback_update_inode(struct nfs_pgio_header *hdr)
    {
    - struct nfs_fattr *fattr = hdr->res.fattr;
    + struct nfs_fattr *fattr = &hdr->fattr;
    struct inode *inode = hdr->inode;

    - if (fattr == NULL)
    - return;
    spin_lock(&inode->i_lock);
    nfs_writeback_check_extend(hdr, fattr);
    nfs_post_op_update_inode_force_wcc_locked(inode, fattr);



    \
     
     \ /
      Last update: 2015-09-26 23:41    [W:4.043 / U:0.308 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site