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: v5.15.178~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e3ded34f3f3c9d7ed2aac7be8cf51153646574a;p=thirdparty%2Fkernel%2Fstable.git gfs2: Truncate address space when flipping GFS2_DIF_JDATA flag commit 7c9d9223802fbed4dee1ae301661bf346964c9d2 upstream. 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index e93185d804e0a..744eb526254e0 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -257,6 +257,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); }