The checks are bogus because they check against inode->i_flags instead of inode->i_state. Use the inode_or_folios_dirty() helper which actually checks what was intended. Fixes: 957a7acd46e6 ("gfs2: Remove inode from ordered write list in gfs2_write_inode()") Fixes: bd67f17718cc ("gfs2: Fix data loss during inode evict") Signed-off-by: Jan Kara --- fs/gfs2/super.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 04bb4cf787d4..9b723dd591a5 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c @@ -460,7 +460,7 @@ static int gfs2_write_inode(struct inode *inode, struct writeback_control *wbc) mark_inode_dirty_sync(inode); else { spin_lock(&inode->i_lock); - if (!(inode->i_flags & I_DIRTY)) + if (!inode_or_folios_dirty(inode)) gfs2_ordered_del_inode(ip); spin_unlock(&inode->i_lock); } @@ -1418,7 +1418,8 @@ static int evict_linked_inode(struct inode *inode, struct gfs2_holder *gh) struct address_space *metamapping = gfs2_glock2aspace(gl); int ret; - if (!(test_bit(GLF_DIRTY, &gl->gl_flags) || inode->i_flags & I_DIRTY)) + if (!(test_bit(GLF_DIRTY, &gl->gl_flags) || + inode_or_folios_dirty(inode))) goto clean; /* The inode glock must be held exclusively and be instantiated. */ -- 2.53.0