lkml.org 
[lkml]   [2018]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.18 065/105] gfs2: Special-case rindex for gfs2_grow
    Date
    3.18-stable review patch.  If anyone has any objections, please let me know.

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

    From: Andreas Gruenbacher <agruenba@redhat.com>

    [ Upstream commit 776125785a87ff05d49938bd5b9f336f2a05bff6 ]

    To speed up the common case of appending to a file,
    gfs2_write_alloc_required presumes that writing beyond the end of a file
    will always require additional blocks to be allocated. This assumption
    is incorrect for preallocates files, but there are no negative
    consequences as long as *some* space is still left on the filesystem.

    One special file that always has some space preallocated beyond the end
    of the file is the rindex: when growing a filesystem, gfs2_grow adds one
    or more new resource groups and appends records describing those
    resource groups to the rindex; the preallocated space ensures that this
    is always possible.

    However, when a filesystem is completely full, gfs2_write_alloc_required
    will indicate that an additional allocation is required, and appending
    the next record to the rindex will fail even though space for that
    record has already been preallocated. To fix that, skip the incorrect
    optimization in gfs2_write_alloc_required, but for the rindex only.
    Other writes to preallocated space beyond the end of the file are still
    allowed to fail on completely full filesystems.

    Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
    Reviewed-by: Bob Peterson <rpeterso@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    fs/gfs2/bmap.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/fs/gfs2/bmap.c
    +++ b/fs/gfs2/bmap.c
    @@ -1476,7 +1476,7 @@ int gfs2_write_alloc_required(struct gfs
    end_of_file = (i_size_read(&ip->i_inode) + sdp->sd_sb.sb_bsize - 1) >> shift;
    lblock = offset >> shift;
    lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift;
    - if (lblock_stop > end_of_file)
    + if (lblock_stop > end_of_file && ip != GFS2_I(sdp->sd_rindex))
    return 1;

    size = (lblock_stop - lblock) << shift;

    \
     
     \ /
      Last update: 2018-09-24 13:45    [W:4.071 / U:0.212 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site