Re: [PATCH v3] ext4: fix circular lock dependency in ext4_ext_migrate

From: Zhou, Yun

Date: Tue Jun 16 2026 - 03:57:29 EST


Move iput(tmp_inode) after ext4_writepages_up_write() to avoid a
circular lock dependency between s_writepages_rwsem and sb_internal
(freeze protection).

The deadlock scenario:

CPU0 (EXT4_IOC_MIGRATE) CPU1 (orphan cleanup during mount)
---- ----
ext4_ext_migrate()
ext4_writepages_down_write()
s_writepages_rwsem (write)
ext4_evict_inode()
sb_start_intwrite() [sb_internal]
...
ext4_writepages()
s_writepages_rwsem (read) [BLOCKED]
iput(tmp_inode)
ext4_evict_inode()
sb_start_intwrite() [BLOCKED]

The tmp_inode is a temporary inode with nlink=0 created solely for
building the extent tree. Its eviction does not require
s_writepages_rwsem protection, so deferring iput() until after
releasing the rwsem is safe.

Reported-by: syzbot+212e8f62790f8e0bc63b@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://syzkaller.appspot.com/bug?extid=212e8f62790f8e0bc63b
Fixes: cb85f4d23f79 ("ext4: fix race between writepages and enabling EXT4_EXTENTS_FL")
Signed-off-by: Yun Zhou <yun.zhou@xxxxxxxxxxxxx>
Reviewed-by: Jan Kara <jack@xxxxxxx>
---
v3: fixes Reported-by tag and Closes tag.

v2: remove redundant null pointer check for iput(tmp_inode).

fs/ext4/migrate.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Hi Honza,

Thank you very much for taking the time to review these patches and providing your valuable suggestions. I am eager to solve these long-standing deadlock issues on Syzkaller, but I do not have much community experience. I'd like to know, regarding this patch, should I launch a new RR thread or continue waiting? BR, Yun