Skip to content

Commit

Permalink
gfs2: Truncate address space when flipping GFS2_DIF_JDATA flag
Browse files Browse the repository at this point in the history
commit 7c9d922 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 <[email protected]>, Jiaji Qin <[email protected]>
Signed-off-by: Andreas Gruenbacher <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Andreas Gruenbacher authored and gregkh committed Feb 1, 2025
1 parent 09f6986 commit 8c41abc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/gfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ static int do_gfs2_set_flags(struct file *filp, 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);
}
Expand Down

0 comments on commit 8c41abc

Please sign in to comment.