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

From: Jan Kara

Date: Tue Jun 16 2026 - 05:07:55 EST


Hello Yun!

On Tue 16-06-26 15:51:13, Zhou, Yun wrote:
> > 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(-)
>
> 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

Please keep waiting. On Sunday the merge window for 7.2-rc1 has opened.
That means that about week before and at least for the next week,
maintainers often aren't taking any patches in their trees. I expect Ted to
pick your patch later when he collects fixes to send for 7.2-rc2 or so - he
sends email about that as a reply to the patch. If nothing happens for next
two weeks, I suggest you send a ping asking whether the patch didn't get
lost as a reply to your patch submission. Thanks for your fixes!

Honza

--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR