lkml.org 
[lkml]   [2019]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH AUTOSEL 5.1 025/375] orangefs: truncate before updating size
    I don't think it makes much sense to put this one in stable.  Without
    the rest of the pagecache patches the race doesn't exist.

    Martin

    On Wed, May 22, 2019 at 03:15:25PM -0400, Sasha Levin wrote:
    > From: Martin Brandenburg <martin@omnibond.com>
    >
    > [ Upstream commit 33713cd09ccdc1e01b10d0782ae60200d4989553 ]
    >
    > Otherwise we race with orangefs_writepage/orangefs_writepages
    > which and does not expect i_size < page_offset.
    >
    > Fixes xfstests generic/129.
    >
    > Signed-off-by: Martin Brandenburg <martin@omnibond.com>
    > Signed-off-by: Mike Marshall <hubcap@omnibond.com>
    > Signed-off-by: Sasha Levin <sashal@kernel.org>
    > ---
    > fs/orangefs/inode.c | 6 +++++-
    > 1 file changed, 5 insertions(+), 1 deletion(-)
    >
    > diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
    > index c3334eca18c7e..3260f757c0803 100644
    > --- a/fs/orangefs/inode.c
    > +++ b/fs/orangefs/inode.c
    > @@ -172,7 +172,11 @@ static int orangefs_setattr_size(struct inode *inode, struct iattr *iattr)
    > }
    > orig_size = i_size_read(inode);
    >
    > - truncate_setsize(inode, iattr->ia_size);
    > + /* This is truncate_setsize in a different order. */
    > + truncate_pagecache(inode, iattr->ia_size);
    > + i_size_write(inode, iattr->ia_size);
    > + if (iattr->ia_size > orig_size)
    > + pagecache_isize_extended(inode, orig_size, iattr->ia_size);
    >
    > new_op = op_alloc(ORANGEFS_VFS_OP_TRUNCATE);
    > if (!new_op)
    > --
    > 2.20.1
    >

    \
     
     \ /
      Last update: 2019-05-22 23:45    [W:4.157 / U:1.184 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site