lkml.org 
[lkml]   [2022]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.18 404/879] iomap: iomap_write_failed fix
    Date
    From: Andreas Gruenbacher <agruenba@redhat.com>

    [ Upstream commit b71450e2cc4b3c79f33c5bd276d152af9bd54f79 ]

    The @lend parameter of truncate_pagecache_range() should be the offset
    of the last byte of the hole, not the first byte beyond it.

    Fixes: ae259a9c8593 ("fs: introduce iomap infrastructure")
    Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    fs/iomap/buffered-io.c | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)

    diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
    index 8ce8720093b9..358ee1fb6f0d 100644
    --- a/fs/iomap/buffered-io.c
    +++ b/fs/iomap/buffered-io.c
    @@ -531,7 +531,8 @@ iomap_write_failed(struct inode *inode, loff_t pos, unsigned len)
    * write started inside the existing inode size.
    */
    if (pos + len > i_size)
    - truncate_pagecache_range(inode, max(pos, i_size), pos + len);
    + truncate_pagecache_range(inode, max(pos, i_size),
    + pos + len - 1);
    }

    static int iomap_read_folio_sync(loff_t block_start, struct folio *folio,
    --
    2.35.1


    \
     
     \ /
      Last update: 2022-06-08 02:20    [W:2.053 / U:0.764 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site