Re: [PATCH] f2fs: avoid the deadlock case when stopping discard thread
From: Hillf Danton
Date: Fri Mar 22 2024 - 07:34:44 EST
On Thu, 21 Mar 2024 17:29:03 -0700 Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
>
> I posted this patch before Light reported.
Yeah, his report's timestamp is 2024-03-20 6:59, nearly 7 hours later,
which shows that you constructed the deadlock with nothing to do with
his report.
>
> And, in the report, I didn't get this:
>
> f2fs_ioc_shutdown() --> freeze_bdev() --> freeze_super() --> sb_wait_write(sb, SB_FREEZE_FS) --> ... ->percpu_down_write().
>
> because f2fs_ioc_shutdown() calls f2fs_stop_discard_thread() after thaw_bdev()
> like this order.
>
> -> freeze_bdev()
> -> thaw_bdev()
> -> f2fs_stop_discard_thread()
>
> Am I missing something?
Light, could you specify to help Jaegeuk understand the deadlock you reported?