Re: [PATCH] ext4: fix i_data_sem unlock order in ext4_ind_migrate()

From: Theodore Ts'o
Date: Thu Apr 04 2024 - 22:27:21 EST


On Thu, Apr 04, 2024 at 12:50:00PM +0300, Mikhail Ukhin wrote:
> Fuzzing reports a possible deadlock in jbd2_log_wait_commit.
>
> The problem occurs in ext4_ind_migrate due to an incorrect order of
> unlocking of the journal and write semaphores - the order of unlocking
> must be the reverse of the order of locking.
>
> Found by Linux Verification Center (linuxtesting.org) with syzkaller.

This doesn't make any sense. Lock order matters; the order in which
you unlock shouldn't (and doesn't) make a difference. This is also
something which lockdep doesn't complain about --- because it's not a
problem.

So how was this "found by syzkaller"?

- Ted