Re: [PATCH] vfs: Fix potential circular locking through setxattr() and removexattr()

From: Matthew Wilcox
Date: Tue Jul 23 2024 - 22:42:34 EST


On Wed, Jul 24, 2024 at 11:34:57AM +1000, Dave Chinner wrote:
> This is to prevent the deadlocks on upper->lower->upper and
> lower->upper->lower filesystem recursion via GFP_KERNEL memory
> allocation and reclaim recursing between the two filesystems. This
> is especially relevant for filesystems with ->writepage methods that
> can be called from direct reclaim. Hence allocations in this path
> need to be at least NOFS to prevent recursion back into the upper
> filesystem from writeback into the lower filesystem.

FYI, we're making good progress on removing ->writepage.

$ git grep '\.writepage\>.*='
fs/ceph/addr.c: .writepage = ceph_writepage,
fs/ecryptfs/mmap.c: .writepage = ecryptfs_writepage,
fs/f2fs/checkpoint.c: .writepage = f2fs_write_meta_page,
fs/f2fs/data.c: .writepage = f2fs_write_data_page,
fs/f2fs/node.c: .writepage = f2fs_write_node_page,
fs/gfs2/aops.c: .writepage = gfs2_jdata_writepage,
fs/gfs2/meta_io.c: .writepage = gfs2_aspace_writepage,
fs/gfs2/meta_io.c: .writepage = gfs2_aspace_writepage,
fs/hostfs/hostfs_kern.c: .writepage = hostfs_writepage,
fs/nilfs2/inode.c: .writepage = nilfs_writepage,
fs/nilfs2/mdt.c: .writepage = nilfs_mdt_write_page,
fs/orangefs/inode.c: .writepage = orangefs_writepage,
fs/vboxsf/file.c: .writepage = vboxsf_writepage,
mm/shmem.c: .writepage = shmem_writepage,
mm/swap_state.c: .writepage = swap_writepage,

so mostly just the usual stragglers. I sent a series to fix up gfs2
earlier this week:
https://lore.kernel.org/linux-fsdevel/20240719175105.788253-1-willy@xxxxxxxxxxxxx/