From: Darrick J. Wong <djwong@kernel.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH v3 2/3] iomap: Don't create iomap_page objects for inline files
Date: Thu, 8 Jul 2021 21:28:26 -0700 [thread overview]
Message-ID: <20210709042826.GU11588@locust> (raw)
In-Reply-To: <20210707115524.2242151-3-agruenba@redhat.com>
On Wed, Jul 07, 2021 at 01:55:23PM +0200, Andreas Gruenbacher wrote:
> In iomap_readpage_actor, don't create iop objects for inline inodes.
> Otherwise, iomap_read_inline_data will set PageUptodate without setting
> iop->uptodate, and iomap_page_release will eventually complain.
>
> To prevent this kind of bug from occurring in the future, make sure the
> page doesn't have private data attached in iomap_read_inline_data.
>
> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Looks good to me,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> fs/iomap/buffered-io.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> index 598fcfabc337..6330dabc451e 100644
> --- a/fs/iomap/buffered-io.c
> +++ b/fs/iomap/buffered-io.c
> @@ -215,6 +215,7 @@ iomap_read_inline_data(struct inode *inode, struct page *page,
> if (PageUptodate(page))
> return;
>
> + BUG_ON(page_has_private(page));
> BUG_ON(page->index);
> BUG_ON(size > PAGE_SIZE - offset_in_page(iomap->inline_data));
>
> @@ -239,7 +240,7 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
> {
> struct iomap_readpage_ctx *ctx = data;
> struct page *page = ctx->cur_page;
> - struct iomap_page *iop = iomap_page_create(inode, page);
> + struct iomap_page *iop;
> bool same_page = false, is_contig = false;
> loff_t orig_pos = pos;
> unsigned poff, plen;
> @@ -252,6 +253,7 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
> }
>
> /* zero post-eof blocks as the page may be mapped */
> + iop = iomap_page_create(inode, page);
> iomap_adjust_read_range(inode, iop, &pos, length, &poff, &plen);
> if (plen == 0)
> goto done;
> --
> 2.26.3
>
WARNING: multiple messages have this Message-ID (diff)
From: "Darrick J. Wong" <djwong@kernel.org>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>,
Matthew Wilcox <willy@infradead.org>,
linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
cluster-devel@redhat.com
Subject: Re: [PATCH v3 2/3] iomap: Don't create iomap_page objects for inline files
Date: Thu, 8 Jul 2021 21:28:26 -0700 [thread overview]
Message-ID: <20210709042826.GU11588@locust> (raw)
In-Reply-To: <20210707115524.2242151-3-agruenba@redhat.com>
On Wed, Jul 07, 2021 at 01:55:23PM +0200, Andreas Gruenbacher wrote:
> In iomap_readpage_actor, don't create iop objects for inline inodes.
> Otherwise, iomap_read_inline_data will set PageUptodate without setting
> iop->uptodate, and iomap_page_release will eventually complain.
>
> To prevent this kind of bug from occurring in the future, make sure the
> page doesn't have private data attached in iomap_read_inline_data.
>
> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Looks good to me,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> fs/iomap/buffered-io.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> index 598fcfabc337..6330dabc451e 100644
> --- a/fs/iomap/buffered-io.c
> +++ b/fs/iomap/buffered-io.c
> @@ -215,6 +215,7 @@ iomap_read_inline_data(struct inode *inode, struct page *page,
> if (PageUptodate(page))
> return;
>
> + BUG_ON(page_has_private(page));
> BUG_ON(page->index);
> BUG_ON(size > PAGE_SIZE - offset_in_page(iomap->inline_data));
>
> @@ -239,7 +240,7 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
> {
> struct iomap_readpage_ctx *ctx = data;
> struct page *page = ctx->cur_page;
> - struct iomap_page *iop = iomap_page_create(inode, page);
> + struct iomap_page *iop;
> bool same_page = false, is_contig = false;
> loff_t orig_pos = pos;
> unsigned poff, plen;
> @@ -252,6 +253,7 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
> }
>
> /* zero post-eof blocks as the page may be mapped */
> + iop = iomap_page_create(inode, page);
> iomap_adjust_read_range(inode, iop, &pos, length, &poff, &plen);
> if (plen == 0)
> goto done;
> --
> 2.26.3
>
next prev parent reply other threads:[~2021-07-09 4:28 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-07 11:55 [Cluster-devel] [PATCH v3 0/3] iomap: small block problems Andreas Gruenbacher
2021-07-07 11:55 ` Andreas Gruenbacher
2021-07-07 11:55 ` [Cluster-devel] [PATCH v3 1/3] iomap: Permit pages without an iop to enter writeback Andreas Gruenbacher
2021-07-07 11:55 ` Andreas Gruenbacher
2021-07-09 4:23 ` [Cluster-devel] " Darrick J. Wong
2021-07-09 4:23 ` Darrick J. Wong
2021-07-07 11:55 ` [Cluster-devel] [PATCH v3 2/3] iomap: Don't create iomap_page objects for inline files Andreas Gruenbacher
2021-07-07 11:55 ` Andreas Gruenbacher
2021-07-07 14:28 ` [Cluster-devel] " Matthew Wilcox
2021-07-07 14:28 ` Matthew Wilcox
2021-07-09 4:27 ` [Cluster-devel] " Darrick J. Wong
2021-07-09 4:27 ` Darrick J. Wong
2021-07-09 6:21 ` [Cluster-devel] " Christoph Hellwig
2021-07-09 6:21 ` Christoph Hellwig
2021-07-09 12:01 ` [Cluster-devel] " Matthew Wilcox
2021-07-09 12:01 ` Matthew Wilcox
2021-07-09 4:28 ` Darrick J. Wong [this message]
2021-07-09 4:28 ` Darrick J. Wong
2021-07-09 6:20 ` [Cluster-devel] " Christoph Hellwig
2021-07-09 6:20 ` Christoph Hellwig
2021-07-07 11:55 ` [Cluster-devel] [PATCH v3 3/3] iomap: Don't create iomap_page objects in iomap_page_mkwrite_actor Andreas Gruenbacher
2021-07-07 11:55 ` Andreas Gruenbacher
2021-07-07 14:03 ` [Cluster-devel] " Matthew Wilcox
2021-07-07 14:03 ` Matthew Wilcox
2021-07-09 4:29 ` [Cluster-devel] " Darrick J. Wong
2021-07-09 4:29 ` Darrick J. Wong
2021-07-09 11:07 ` [Cluster-devel] " Andreas Gruenbacher
2021-07-09 11:07 ` Andreas Gruenbacher
2021-07-09 6:22 ` [Cluster-devel] " Christoph Hellwig
2021-07-09 6:22 ` 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=20210709042826.GU11588@locust \
--to=djwong@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.