From: Andreas Gruenbacher <agruenba@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [RFC v2 3/3] gfs2: Fix race between shrinker and gfs2_iomap_folio_done
Date: Thu, 1 Dec 2022 19:09:57 +0100 [thread overview]
Message-ID: <20221201180957.1268079-4-agruenba@redhat.com> (raw)
In-Reply-To: <20221201160619.1247788-1-agruenba@redhat.com>
In gfs2_iomap_folio_done(), add the modified buffer heads to the current
transaction while the folio is still locked. Otherwise, the shrinker
can come in and free them before we get to gfs2_page_add_databufs().
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
fs/gfs2/bmap.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 18dcaa95408e..d8d9ee843ac9 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -990,18 +990,17 @@ gfs2_iomap_folio_done(struct inode *inode, struct folio *folio,
struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = GFS2_SB(inode);
- folio_unlock(folio);
-
if (!gfs2_is_stuffed(ip))
gfs2_page_add_databufs(ip, &folio->page, offset_in_page(pos),
copied);
+ folio_unlock(folio);
+ folio_put(folio);
+
if (tr->tr_num_buf_new)
__mark_inode_dirty(inode, I_DIRTY_DATASYNC);
gfs2_trans_end(sdp);
-
- folio_put(folio);
}
static const struct iomap_folio_ops gfs2_iomap_folio_ops = {
--
2.38.1
prev parent reply other threads:[~2022-12-01 18:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-01 16:06 [Cluster-devel] [RFC 0/3] Turn iomap_page_ops into iomap_folio_ops Andreas Gruenbacher
2022-12-01 16:06 ` [Cluster-devel] [RFC 1/3] fs: Add folio_may_straddle_isize helper Andreas Gruenbacher
2022-12-01 16:06 ` [Cluster-devel] [RFC 2/3] iomap: Turn iomap_page_ops into iomap_folio_ops Andreas Gruenbacher
2022-12-01 16:06 ` [Cluster-devel] [RFC 3/3] gfs2: Fix race between shrinker and gfs2_iomap_folio_done Andreas Gruenbacher
2022-12-01 18:09 ` [Cluster-devel] [RFC v2 0/3] Turn iomap_page_ops into iomap_folio_ops Andreas Gruenbacher
2022-12-01 21:29 ` Dave Chinner
2022-12-02 1:54 ` Andreas Gruenbacher
2022-12-05 23:04 ` Dave Chinner
2022-12-01 18:09 ` [Cluster-devel] [RFC v2 1/3] fs: Add folio_may_straddle_isize helper Andreas Gruenbacher
2022-12-01 18:09 ` [Cluster-devel] [RFC v2 2/3] iomap: Turn iomap_page_ops into iomap_folio_ops Andreas Gruenbacher
2022-12-01 18:09 ` Andreas Gruenbacher [this message]
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=20221201180957.1268079-4-agruenba@redhat.com \
--to=agruenba@redhat.com \
/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).