From: Andreas Gruenbacher Date: Mon, 13 Jan 2025 18:31:28 +0000 (+0100) Subject: gfs2: Truncate address space when flipping GFS2_DIF_JDATA flag X-Git-Tag: v6.14-rc1~208^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7c9d9223802fbed4dee1ae301661bf346964c9d2;p=thirdparty%2Fkernel%2Flinux.git gfs2: Truncate address space when flipping GFS2_DIF_JDATA flag Truncate an inode's address space when flipping the GFS2_DIF_JDATA flag: depending on that flag, the pages in the address space will either use buffer heads or iomap_folio_state structs, and we cannot mix the two. Reported-by: Kun Hu , Jiaji Qin Signed-off-by: Andreas Gruenbacher --- diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 1e73cf87ff88b..c9bb3be21d2ba 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -251,6 +251,7 @@ static int do_gfs2_set_flags(struct inode *inode, u32 reqflags, u32 mask) error = filemap_fdatawait(inode->i_mapping); if (error) goto out; + truncate_inode_pages(inode->i_mapping, 0); if (new_flags & GFS2_DIF_JDATA) gfs2_ordered_del_inode(ip); }