From: Jaegeuk Kim <jaegeuk@kernel.org>
To: "Light Hsieh (謝明燈)" <Light.Hsieh@mediatek.com>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"Chun-Hung Wu (巫駿宏)" <Chun-hung.Wu@mediatek.com>,
"linux-f2fs-devel@lists.sourceforge.net"
<linux-f2fs-devel@lists.sourceforge.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Ed Tsai (蔡宗軒)" <Ed.Tsai@mediatek.com>
Subject: Re: [f2fs-dev] 回覆: 回覆: f2fs F2FS_IOC_SHUTDOWN hang issue
Date: Thu, 21 Mar 2024 17:30:13 -0700 [thread overview]
Message-ID: <ZfzRFU_cXkToBoQ0@google.com> (raw)
In-Reply-To: <SI2PR03MB52605816252C9ABA3D8550F084322@SI2PR03MB5260.apcprd03.prod.outlook.com>
On 03/21, Light Hsieh (謝明燈) wrote:
> Do you mean:
>
> + /* Avoid the deadlock from F2FS_GOING_DOWN_NOSYNC. */
> + if (!sb_start_intwrite_trylock(sbi->sb))
> + continue;
>
> After failure of trylock, the 'continue' make code flow goto the line:
> } while (!kthread_should_stop());
> Since kthrad_should_stop() is true now, so the issue_discard_thread will end?
Yes, but now I'm confused who is taking write_sem. :(
>
> Light
> ________________________________
> 寄件者: Jaegeuk Kim <jaegeuk@kernel.org>
> 寄件日期: 2024年3月21日 上午 08:39
> 收件者: Light Hsieh (謝明燈) <Light.Hsieh@mediatek.com>
> 副本: 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>
> 主旨: Re: 回覆: f2fs F2FS_IOC_SHUTDOWN hang issue
>
>
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> On 03/20, Light Hsieh (謝明燈) wrote:
> > On 2024/3/20 8:14, Jaegeuk Kim wrote:
> > > f2fs_ioc_shutdown(F2FS_GOING_DOWN_NOSYNC) issue_discard_thread
> > > - mnt_want_write_file()
> > > - sb_start_write(SB_FREEZE_WRITE)
> > > - sb_start_intwrite(SB_FREEZE_FS);
> > > - f2fs_stop_checkpoint(sbi, false, : waiting
> > > STOP_CP_REASON_SHUTDOWN);
> > > - f2fs_stop_discard_thread(sbi);
> > > - kthread_stop()
> > > : waiting
> > >
> > > - mnt_drop_write_file(filp);
> > >
> > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> >
> > The case I encounter is f2fs_ic_shutdown with arg F2FS_GOING_DOWN_FULLSYNC, not F2FS_GOING_DOWN_NOSYNC.
> >
> > Or you are meaning that: besides the kernel patch, I need to change the invoked F2FS_IOC_SHUTDOWN to use arg F2FS_GOING_DOWN_NOSYNC?
>
> I think this patch also addresses your case by using trylock.
>
> >
> >
> >
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
WARNING: multiple messages have this Message-ID (diff)
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: Thu, 21 Mar 2024 17:30:13 -0700 [thread overview]
Message-ID: <ZfzRFU_cXkToBoQ0@google.com> (raw)
In-Reply-To: <SI2PR03MB52605816252C9ABA3D8550F084322@SI2PR03MB5260.apcprd03.prod.outlook.com>
On 03/21, Light Hsieh (謝明燈) wrote:
> Do you mean:
>
> + /* Avoid the deadlock from F2FS_GOING_DOWN_NOSYNC. */
> + if (!sb_start_intwrite_trylock(sbi->sb))
> + continue;
>
> After failure of trylock, the 'continue' make code flow goto the line:
> } while (!kthread_should_stop());
> Since kthrad_should_stop() is true now, so the issue_discard_thread will end?
Yes, but now I'm confused who is taking write_sem. :(
>
> Light
> ________________________________
> 寄件者: Jaegeuk Kim <jaegeuk@kernel.org>
> 寄件日期: 2024年3月21日 上午 08:39
> 收件者: Light Hsieh (謝明燈) <Light.Hsieh@mediatek.com>
> 副本: 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>
> 主旨: Re: 回覆: f2fs F2FS_IOC_SHUTDOWN hang issue
>
>
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> On 03/20, Light Hsieh (謝明燈) wrote:
> > On 2024/3/20 8:14, Jaegeuk Kim wrote:
> > > f2fs_ioc_shutdown(F2FS_GOING_DOWN_NOSYNC) issue_discard_thread
> > > - mnt_want_write_file()
> > > - sb_start_write(SB_FREEZE_WRITE)
> > > - sb_start_intwrite(SB_FREEZE_FS);
> > > - f2fs_stop_checkpoint(sbi, false, : waiting
> > > STOP_CP_REASON_SHUTDOWN);
> > > - f2fs_stop_discard_thread(sbi);
> > > - kthread_stop()
> > > : waiting
> > >
> > > - mnt_drop_write_file(filp);
> > >
> > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> >
> > The case I encounter is f2fs_ic_shutdown with arg F2FS_GOING_DOWN_FULLSYNC, not F2FS_GOING_DOWN_NOSYNC.
> >
> > Or you are meaning that: besides the kernel patch, I need to change the invoked F2FS_IOC_SHUTDOWN to use arg F2FS_GOING_DOWN_NOSYNC?
>
> I think this patch also addresses your case by using trylock.
>
> >
> >
> >
>
next prev parent reply other threads:[~2024-03-22 0:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-15 9:12 [f2fs-dev] [syzbot] [f2fs?] KASAN: slab-use-after-free Read in f2fs_filemap_fault syzbot
2024-01-15 9:12 ` 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 ` [f2fs-dev] " Jaegeuk Kim
2024-03-13 1:31 ` Jaegeuk Kim
2024-03-14 2:19 ` [f2fs-dev] " Chao Yu
2024-03-14 2:19 ` 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 ` [f2fs-dev] " Jaegeuk Kim
2024-03-20 20:06 ` Jaegeuk Kim
2024-03-20 23:34 ` 回覆: " Light Hsieh (謝明燈)
2024-03-21 0:39 ` [f2fs-dev] " Jaegeuk Kim
2024-03-21 0:39 ` Jaegeuk Kim
[not found] ` <SI2PR03MB52605816252C9ABA3D8550F084322@SI2PR03MB5260.apcprd03.prod.outlook.com>
2024-03-22 0:30 ` Jaegeuk Kim [this message]
2024-03-22 0:30 ` 回覆: " Jaegeuk Kim
2024-03-13 14:32 ` [f2fs-dev] [syzbot] [f2fs?] KASAN: slab-use-after-free Read in f2fs_filemap_fault Chao Yu
2024-03-13 14:32 ` Chao Yu
2024-03-13 14:50 ` [f2fs-dev] " syzbot
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=ZfzRFU_cXkToBoQ0@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.