From: Matthew Wilcox <willy@infradead.org>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>,
"Darrick J . Wong" <djwong@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] iomap: iomap_write_failed fix
Date: Tue, 3 May 2022 22:44:25 +0100 [thread overview]
Message-ID: <YnGiOVCSfHP0iOBo@casper.infradead.org> (raw)
In-Reply-To: <20220503213645.3273828-1-agruenba@redhat.com>
On Tue, May 03, 2022 at 11:36:45PM +0200, Andreas Gruenbacher wrote:
> 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")
Hm, yes, this is _true_, but it's a fix without importance (except maybe
for an overflow case?) Look at the condition this is called in. We
aren't punching out an extra byte in the page cache because we're
punching beyond the end of the file.
It should be fixed because people copy-and-paste code. But it's not
urgent, and doesn't need to be backported.
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
> ---
> 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
>
next prev parent reply other threads:[~2022-05-03 21:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-03 21:36 [PATCH] iomap: iomap_write_failed fix Andreas Gruenbacher
2022-05-03 21:44 ` Matthew Wilcox [this message]
2022-05-03 23:03 ` Darrick J. Wong
2022-05-04 14:09 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YnGiOVCSfHP0iOBo@casper.infradead.org \
--to=willy@infradead.org \
--cc=agruenba@redhat.com \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).