[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZgL9NLLiSdDeIMg_@google.com>
Date: Tue, 26 Mar 2024 16:52:04 +0000
From: Jaegeuk Kim <jaegeuk@...nel.org>
To: Light Hsieh (謝明燈) <Light.Hsieh@...iatek.com>
Cc: Hillf Danton <hdanton@...a.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-f2fs-devel@...ts.sourceforge.net" <linux-f2fs-devel@...ts.sourceforge.net>
Subject: Re: 回覆: [PATCH] f2fs: avoid the
deadlock case when stopping discard thread
On 03/22, Jaegeuk Kim wrote:
> On 03/22, Light Hsieh (謝明燈) wrote:
> > I don't see my added log in sb_free_unlock() which will invoke percpu_up_write to release the write semaphore.
>
> May I ask more details whether thaw_super() was called or not?
Ping?
>
> >
> >
> > ________________________________
> > 寄件者: Jaegeuk Kim <jaegeuk@...nel.org>
> > 寄件日期: 2024年3月22日 上午 08:29
> > 收件者: Hillf Danton <hdanton@...a.com>
> > 副本: linux-kernel@...r.kernel.org <linux-kernel@...r.kernel.org>; Light Hsieh (謝明燈) <Light.Hsieh@...iatek.com>; linux-f2fs-devel@...ts.sourceforge.net <linux-f2fs-devel@...ts.sourceforge.net>
> > 主旨: Re: [PATCH] f2fs: avoid the deadlock case when stopping discard thread
> >
> >
> > External email : Please do not click links or open attachments until you have verified the sender or the content.
> >
> > On 03/22, Hillf Danton wrote:
> > > On Tue, 19 Mar 2024 17:14:42 -0700 Jaegeuk Kim <jaegeuk@...nel.org>
> > > > f2fs_ioc_shutdown(F2FS_GOING_DOWN_NOSYNC) issue_discard_thread
> > > > - mnt_want_write_file()
> > > > - sb_start_write(SB_FREEZE_WRITE)
> > > __sb_start_write()
> > > percpu_down_read()
> > > > - sb_start_intwrite(SB_FREEZE_FS);
> > > __sb_start_write()
> > > percpu_down_read()
> > >
> > > Given lock acquirers for read on both sides, wtf deadlock are you fixing?
> >
> > Damn. I couldn't think _write uses _read sem.
> >
> > >
> > > > - f2fs_stop_checkpoint(sbi, false, : waiting
> > > > STOP_CP_REASON_SHUTDOWN);
> > > > - f2fs_stop_discard_thread(sbi);
> > > > - kthread_stop()
> > > > : waiting
> > > >
> > > > - mnt_drop_write_file(filp);
> > >
> > > More important, feel free to add in spin.
> >
> > I posted this patch before Light reported.
> >
> > 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?
> >
> > >
> > > Reported-by: "Light Hsieh (謝明燈)" <Light.Hsieh@...iatek.com>
> >
Powered by blists - more mailing lists