]> git.ipfire.org Git - thirdparty/linux.git/commit
gfs2: Fix data loss during inode evict
authorAndreas Gruenbacher <agruenba@redhat.com>
Mon, 10 Nov 2025 21:18:44 +0000 (21:18 +0000)
committerAndreas Gruenbacher <agruenba@redhat.com>
Mon, 23 Mar 2026 19:55:27 +0000 (20:55 +0100)
commitbd67f17718ccb3e99ab834f4d32f848a471e6bbf
tree8eaa4a472da66c333814c0006d57158e56b46014
parent2b34a9e760f484a437a768781444da1f67a92768
gfs2: Fix data loss during inode evict

When gfs2_evict_inode() is called on an inode with unwritten data in the
page cache, the page cache needs to be written before it can be
truncated.  This doesn't always happen.  Fix that by changing
gfs2_evict_inode() to always either call evict_linked_inode() or
evict_unlinked_inode().

Inside evict_unlinked_inode(), first check if the inode is dirty.  If it
is, make sure the inode glock is held and write back the data and
metadata.  If it isn't, skip those steps.

Also, make sure that gfs2_evict_inode() calls gfs2_evict_inode() and
evict_unlinked_inode() only if ip->i_gl is not NULL; this avoids
unnecessary complications there.

Fixes xfstest generic/211.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/super.c