Re: [BUG REPORT] potential deadlock in inode evicting under the inode lru traversing context on ext4 and ubifs

From: Zhihao Cheng
Date: Sun Aug 04 2024 - 21:29:35 EST


Hi, based on the ideas from Jan and Mateusz, I sent a fix patch, see https://lore.kernel.org/linux-fsdevel/20240805013446.814357-1-chengzhihao@xxxxxxxxxxxxxxx/T/#u

在 2024/7/12 14:27, Zhihao Cheng 写道:
Hi. Recently, we found a deadlock in inode recliaiming process caused by circular dependence between file inode and file's xattr inode.

Problem description
===================

The inode reclaiming process(See function prune_icache_sb) collects all reclaimable inodes and mark them with I_FREEING flag at first, at that time, other processes will be stuck if they try getting these inodes(See function find_inode_fast), then the reclaiming process destroy the inodes by function dispose_list().
Some filesystems(eg. ext4 with ea_inode feature, ubifs with xattr) may do inode lookup in the inode evicting callback function, if the inode lookup is operated under the inode lru traversing context, deadlock problems may happen.