Skip to contentSkip to conversation

Subject: [PATCH] exfat: use truncate_inode_pages_final() at evict_inode()

PATCH Applied Yang Wen 2 participants 2 messages Feb 25 – Feb 26

Subsystems (2)
lore
Share & tools
lore

Yang Wen

author
#0 lore raw

PATCH 1/1 Subject: [PATCH] exfat: use truncate_inode_pages_final() at evict_inode()

Currently, exfat uses truncate_inode_pages() in exfat_evict_inode(). However, truncate_inode_pages() does not mark the mapping as exiting, so reclaim may still install shadow entries for the mapping until the inode teardown completes.

In older kernels like Linux 5.10, if shadow entries are present at that point,clear_inode() can hit

    BUG_ON(inode->i_data.nrexceptional);

To align with VFS eviction semantics and prevent this situation, switch to truncate_inode_pages_final() in ->evict_inode().

Other filesystems were updated to use truncate_inode_pages_final() in ->evict_inode() by commit 91b0abe36a7b ("mm + fs: store shadow entries in page cache")'.

---
 fs/exfat/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/exfat/inode.c +1 -1
index 2fb2d2d5d503..567308aff726 100644
@@ -686,7 +686,7 @@ struct inode *exfat_build_inode(struct super_block *sb,
 
 void exfat_evict_inode(struct inode *inode)
 {
-	truncate_inode_pages(&inode->i_data, 0);
+	truncate_inode_pages_final(&inode->i_data);
 
 	if (!inode->i_nlink) {
 		i_size_write(inode, 0);
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 11 lines · Yang Wen

Currently, exfat uses truncate_inode_pages() in exfat_evict_inode(). However, truncate_inode_pages() does not mark the mapping as exiting, so reclaim may still install shadow entries for the mapping until the inode teardown completes.

In older kernels like Linux 5.10, if shadow entries are present at that point,clear_inode() can hit

    BUG_ON(inode->i_data.nrexceptional);
Quoted 8 lines

To align with VFS eviction semantics and prevent this situation, switch to truncate_inode_pages_final() in ->evict_inode().

Other filesystems were updated to use truncate_inode_pages_final() in ->evict_inode() by commit 91b0abe36a7b ("mm + fs: store shadow entries in page cache")'.

Applied it to #dev.
Thanks!