From: Gao Xiang <hsiangkao@aol.com>
To: Chris Mason <clm@fb.com>
Cc: Dave Chinner <david@fromorbit.com>,
"Darrick J. Wong" <darrick.wong@oracle.com>,
xfs <linux-xfs@vger.kernel.org>, "tj@kernel.org" <tj@kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [5.4-rc1, regression] wb_workfn wakeup oops (was Re: frequent 5.4-rc1 crash?)
Date: Thu, 3 Oct 2019 22:40:46 +0800 [thread overview]
Message-ID: <20191003144041.GA2012@hsiangkao-HP-ZHAN-66-Pro-G1> (raw)
In-Reply-To: <41B90CA7-E093-48FA-BDFD-73BE7EB81FB6@fb.com>
Hi Chris,
On Thu, Oct 03, 2019 at 02:01:13PM +0000, Chris Mason wrote:
>
>
> On 3 Oct 2019, at 4:41, Gao Xiang wrote:
>
> > Hi,
> >
> > On Thu, Oct 03, 2019 at 04:40:22PM +1000, Dave Chinner wrote:
> >> [cc linux-fsdevel, linux-block, tejun ]
> >>
> >> On Wed, Oct 02, 2019 at 06:52:47PM -0700, Darrick J. Wong wrote:
> >>> Hi everyone,
> >>>
> >>> Does anyone /else/ see this crash in generic/299 on a V4 filesystem
> >>> (tho
> >>> afaict V5 configs crash too) and a 5.4-rc1 kernel? It seems to pop
> >>> up
> >>> on generic/299 though only 80% of the time.
> >>>
> >
> > Just a quick glance, I guess there could is a race between (complete
> > guess):
> >
> >
> > 160 static void finish_writeback_work(struct bdi_writeback *wb,
> > 161 struct wb_writeback_work *work)
> > 162 {
> > 163 struct wb_completion *done = work->done;
> > 164
> > 165 if (work->auto_free)
> > 166 kfree(work);
> > 167 if (done && atomic_dec_and_test(&done->cnt))
> >
> > ^^^ here
> >
> > 168 wake_up_all(done->waitq);
> > 169 }
> >
> > since new wake_up_all(done->waitq); is completely on-stack,
> > if (done && atomic_dec_and_test(&done->cnt))
> > - wake_up_all(&wb->bdi->wb_waitq);
> > + wake_up_all(done->waitq);
> > }
> >
> > which could cause use after free if on-stack wb_completion is gone...
> > (however previous wb->bdi is solid since it is not on-stack)
> >
> > see generic on-stack completion which takes a wait_queue spin_lock
> > between
> > test and wake_up...
> >
> > If I am wrong, ignore me, hmm...
>
> It's a good guess ;) Jens should have this queued up already:
>
> https://lkml.org/lkml/2019/9/23/972
Oh, I didn't notice that, it's great to be already resolved. :)
It was not fully guess though, we once had a some similar
pattern at the very early stage last year (a given IO balance
counter, wait_queue. but completion is too heavy), which resolved
in commit 848bd9acdcd0 last year. Therefore I'm experienced
with such cases.
Just saw mailing list regularly and be of some help here...
Sorry about the noise...
Thanks,
Gao Xiang
>
> -chris
prev parent reply other threads:[~2019-10-03 14:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-03 1:52 frequent 5.4-rc1 crash? Darrick J. Wong
2019-10-03 6:40 ` [5.4-rc1, regression] wb_workfn wakeup oops (was Re: frequent 5.4-rc1 crash?) Dave Chinner
2019-10-03 8:41 ` Gao Xiang
2019-10-03 14:01 ` Chris Mason
2019-10-03 14:05 ` Jens Axboe
2019-10-03 18:37 ` Darrick J. Wong
2019-10-06 22:30 ` Darrick J. Wong
2019-10-08 3:20 ` Jens Axboe
2019-10-03 14:40 ` Gao Xiang [this message]
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=20191003144041.GA2012@hsiangkao-HP-ZHAN-66-Pro-G1 \
--to=hsiangkao@aol.com \
--cc=clm@fb.com \
--cc=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=tj@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;
as well as URLs for NNTP newsgroup(s).