From: Jaegeuk Kim <jaegeuk@kernel.org>
To: "Light Hsieh (謝明燈)" <Light.Hsieh@mediatek.com>
Cc: "Ed Tsai (蔡宗軒)" <Ed.Tsai@mediatek.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-f2fs-devel@lists.sourceforge.net"
<linux-f2fs-devel@lists.sourceforge.net>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"Chun-Hung Wu (巫駿宏)" <Chun-hung.Wu@mediatek.com>
Subject: Re: f2fs F2FS_IOC_SHUTDOWN hang issue
Date: Wed, 20 Mar 2024 13:06:30 -0700 [thread overview]
Message-ID: <ZftBxmBFmGCFg35I@google.com> (raw)
In-Reply-To: <SI2PR03MB52600BD4AFAD1E324FD0430584332@SI2PR03MB5260.apcprd03.prod.outlook.com>
Can you try this?
https://patchwork.kernel.org/project/f2fs/patch/20240320001442.497813-1-jaegeuk@kernel.org/
On 03/20, Light Hsieh (謝明燈) wrote:
> Hi Jaegeuk:
>
> We encounter a deadlock issue when Android is going to poweroff.
> Please help check.
>
> When unmounting of f2fs partition fail in Android poweroff procedure, init thread (pid = 1) invoke F2FS_IOC_SHUTDOWN ioctl with arg F2FS_GOING_DOWN_FULLSYNC.
> This ioctl cause down_write of a semaphore in the following call sequence:
> f2fs_ioc_shutdown() --> freeze_bdev() --> freeze_super() --> sb_wait_write(sb, SB_FREEZE_FS) --> ... ->percpu_down_write().
>
> f2fs_ioc_shutdown() will later invoke f2fs_stop_discard_thread() and wait for stopping of f2fs_discard thread in the following call sequence:
> f2fs_ioc_shutdown() -->f2fs_stop_discard_thread() -->kthread_stop(discard_thread) --> wait_for_completion().
> That is, init thread go sleep with a write semaphore.
>
> f2fs_discard thread is then waken up to process f2fs discard.
> However, f2fs_discard threshold may then hang because failing to get the semaphore aleady obtained by the slept init thread:
> issue_discard_thread() --> sb_start_intwrite() -->sb_start_write(sb, SB_FREEZE_FS) --> percpu_down_read()
>
> Light
next prev parent reply other threads:[~2024-03-20 20:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-15 9:12 [syzbot] [f2fs?] KASAN: slab-use-after-free Read in f2fs_filemap_fault syzbot
2024-01-15 12:05 ` Hillf Danton
2024-01-15 19:17 ` syzbot
2024-03-12 1:33 ` Ed Tsai (蔡宗軒)
2024-03-13 1:31 ` Jaegeuk Kim
2024-03-14 2:19 ` [f2fs-dev] " Chao Yu
[not found] ` <SI2PR03MB52600BD4AFAD1E324FD0430584332@SI2PR03MB5260.apcprd03.prod.outlook.com>
2024-03-20 6:59 ` f2fs F2FS_IOC_SHUTDOWN hang issue Light Hsieh (謝明燈)
2024-03-20 20:06 ` Jaegeuk Kim [this message]
2024-03-20 23:34 ` 回覆: " Light Hsieh (謝明燈)
2024-03-21 0:39 ` Jaegeuk Kim
[not found] ` <SI2PR03MB52605816252C9ABA3D8550F084322@SI2PR03MB5260.apcprd03.prod.outlook.com>
2024-03-22 0:30 ` 回覆: " Jaegeuk Kim
2024-03-13 14:32 ` [syzbot] [f2fs?] KASAN: slab-use-after-free Read in f2fs_filemap_fault Chao Yu
2024-03-13 14:50 ` syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZftBxmBFmGCFg35I@google.com \
--to=jaegeuk@kernel.org \
--cc=Chun-hung.Wu@mediatek.com \
--cc=Ed.Tsai@mediatek.com \
--cc=Light.Hsieh@mediatek.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome