回复: [PATCH v2 2/2] PM: hibernate: Fix the exclusive get block device in test_resume mode

From: Feng, ChenzhouX
Date: Wed Sep 06 2023 - 01:27:27 EST




> -----邮件原件-----
> 发件人: Chen, Yu C <yu.c.chen@xxxxxxxxx>
> 发送时间: Wednesday, September 6, 2023 12:19
> 收件人: Rafael J. Wysocki <rafael@xxxxxxxxxx>; Brown, Len
> <len.brown@xxxxxxxxx>; Pavel Machek <pavel@xxxxxx>
> 抄送: linux-pm@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Feng, ChenzhouX
> <chenzhoux.feng@xxxxxxxxx>; Xu, Pengfei <pengfei.xu@xxxxxxxxx>; Chen, Yu C
> <yu.c.chen@xxxxxxxxx>;
> syzbot+38d04642cea49f3a3d2e@xxxxxxxxxxxxxxxxxxxxxxxxx
> 主题: [PATCH v2 2/2] PM: hibernate: Fix the exclusive get block device in
> test_resume mode
>
> commit 5904de0d735b ("PM: hibernate: Do not get block device exclusively in
> test_resume mode") fixes a hibernation issue under test_resume mode.
> That commit is supposed to open the block device in non-exclusive mode when in
> test_resume. However the code did the opposite, which is against its description.
>
> In summary, the swap device is only opened exclusively by swsusp_check() with
> its corresponding *close(), and must be in non test_resume mode.
> This is to avoid the race condition that different processes scribble the device at
> the same time. All the other cases should use non-exclusive mode.
>
> Fix it by really disabling exclusive mode under test_resume.
>
> Fixes: 5904de0d735b ("PM: hibernate: Do not get block device exclusively in
> test_resume mode")
> Reported-by: syzbot+38d04642cea49f3a3d2e@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes:
> https://lore.kernel.org/lkml/000000000000761f5f0603324129@xxxxxxxxxx/
> Reported-by: Pengfei Xu <pengfei.xu@xxxxxxxxx>
> Signed-off-by: Chen Yu <yu.c.chen@xxxxxxxxx>

It works on my machine, for the whole series,
Tested-by: Chenzhou Feng <chenzhoux.feng@xxxxxxxxx>

thanks,
Chenzhou