From: Jan Kara <jack@suse.cz>
To: Lukas Czerner <lczerner@redhat.com>
Cc: Jan Kara <jack@suse.cz>, Eryu Guan <eguan@redhat.com>,
linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: [v4.14-rc3 bug] scheduling while atomic in generic/451 test on extN
Date: Mon, 16 Oct 2017 10:17:08 +0200 [thread overview]
Message-ID: <20171016081708.GF32738@quack2.suse.cz> (raw)
In-Reply-To: <20171013132200.dvc33h26ezwqpqwm@rh_laptop>
On Fri 13-10-17 15:22:00, Lukas Czerner wrote:
> On Fri, Oct 13, 2017 at 12:28:42PM +0200, Lukas Czerner wrote:
> > On Thu, Oct 12, 2017 at 05:07:40PM +0200, Jan Kara wrote:
> > > Hi Eryu!
> > >
> > > On Thu 05-10-17 14:07:00, Eryu Guan wrote:
> > > > I hit "scheduling while atomic" bug by running fstests generic/451 on
> > > > extN filesystems in v4.14-rc3 testing, but it didn't reproduce for me on
> > > > every host I tried, but I've seen it multiple times on multiple hosts. A
> > > > test vm of mine with 4 vcpus and 8G memory reproduced the bug reliably,
> > > > while a bare metal host with 8 cpus and 8G mem couldn't.
> > > >
> > > > This is due to commit 332391a9935d ("fs: Fix page cache inconsistency
> > > > when mixing buffered and AIO DIO"), which defers AIO DIO io completion
> > > > to a workqueue if the inode has mapped pages and does page cache
> > > > invalidation in process context. I think that the problem is that the
> > > > pages can be mapped after the dio->inode->i_mapping->nrpages check, so
> > > > we're doing page cache invalidation, which could sleep, in interrupt
> > > > context, thus "scheduling while atomic" bug happens.
> > > >
> > > > Defering all AIO DIO completion to workqueue unconditionally (as what
> > > > the iomap based path does) fixed the problem for me. But there're
> > > > performance concerns to do so in the original discussions.
> > > >
> > > > https://www.spinics.net/lists/linux-fsdevel/msg112669.html
> > >
> > > Thanks for report and the detailed analysis. I think your analysis is
> > > correct and the nrpages check in dio_bio_end_aio() is racy. My solution to
> > > this would be to pass to dio_complete() as an argument whether invalidation
> > > is required or not (and set it to true for deferred completion and to false
> > > when we decide not to defer completion since nrpages is 0 at that moment).
> > > Lukas?
>
> Btw, instead of changing the arguments, can't we just use
>
> if (current->flags & PF_WQ_WORKER)
>
> to make sure we're called from the workqueue ?
I don't think that would be ideal since dio_complete() can be also called
in task's context where this check would fail...
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
prev parent reply other threads:[~2017-10-16 8:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-05 6:07 [v4.14-rc3 bug] scheduling while atomic in generic/451 test on extN Eryu Guan
2017-10-12 15:07 ` Jan Kara
2017-10-12 16:57 ` Eryu Guan
2017-10-12 19:18 ` Jan Kara
2017-10-13 5:51 ` Eryu Guan
2017-10-13 10:28 ` Lukas Czerner
2017-10-13 13:22 ` Lukas Czerner
2017-10-16 8:17 ` Jan Kara [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=20171016081708.GF32738@quack2.suse.cz \
--to=jack@suse.cz \
--cc=eguan@redhat.com \
--cc=lczerner@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).