From: Matthew Wilcox <willy@infradead.org>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
"Darrick J. Wong" <darrick.wong@oracle.com>,
Mike Snitzer <msnitzer@redhat.com>,
junxiao.bi@oracle.com, dm-devel@redhat.com,
Alasdair Kergon <agk@redhat.com>,
honglei.wang@oracle.com, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH] direct-io: use GFP_NOIO to avoid deadlock
Date: Thu, 8 Aug 2019 06:53:29 -0700 [thread overview]
Message-ID: <20190808135329.GG5482@bombadil.infradead.org> (raw)
In-Reply-To: <alpine.LRH.2.02.1908080540240.15519@file01.intranet.prod.int.rdu2.redhat.com>
On Thu, Aug 08, 2019 at 05:50:10AM -0400, Mikulas Patocka wrote:
> A deadlock with this stacktrace was observed.
>
> The obvious problem here is that in the call chain
> xfs_vm_direct_IO->__blockdev_direct_IO->do_blockdev_direct_IO->kmem_cache_alloc
> we do a GFP_KERNEL allocation while we are in a filesystem driver and in a
> block device driver.
But that's not the problem. The problem is the loop driver calls into the
filesystem without calling memalloc_noio_save() / memalloc_noio_restore().
There are dozens of places in XFS which use GFP_KERNEL allocations and
all can trigger this same problem if called from the loop driver.
> #14 [ffff88272f5af880] kmem_cache_alloc at ffffffff811f484b
> #15 [ffff88272f5af8d0] do_blockdev_direct_IO at ffffffff812535b3
> #16 [ffff88272f5afb00] __blockdev_direct_IO at ffffffff81255dc3
> #17 [ffff88272f5afb30] xfs_vm_direct_IO at ffffffffa01fe3fc [xfs]
> #18 [ffff88272f5afb90] generic_file_read_iter at ffffffff81198994
> #19 [ffff88272f5afc50] __dta_xfs_file_read_iter_2398 at ffffffffa020c970 [xfs]
> #20 [ffff88272f5afcc0] lo_rw_aio at ffffffffa0377042 [loop]
> #21 [ffff88272f5afd70] loop_queue_work at ffffffffa0377c3b [loop]
> #22 [ffff88272f5afe60] kthread_worker_fn at ffffffff810a8a0c
> #23 [ffff88272f5afec0] kthread at ffffffff810a8428
> #24 [ffff88272f5aff50] ret_from_fork at ffffffff81745242
next prev parent reply other threads:[~2019-08-08 13:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-08 9:50 [PATCH] direct-io: use GFP_NOIO to avoid deadlock Mikulas Patocka
2019-08-08 13:53 ` Matthew Wilcox [this message]
2019-08-08 15:13 ` Mikulas Patocka
2019-08-08 15:17 ` [PATCH] loop: set PF_MEMALLOC_NOIO for the worker thread Mikulas Patocka
2019-08-08 16:12 ` Jens Axboe
2019-08-08 14:39 ` [PATCH] direct-io: use GFP_NOIO to avoid deadlock Junxiao Bi
2019-08-09 1:34 ` Dave Chinner
2019-08-09 11:30 ` Mikulas Patocka
2019-08-09 21:57 ` Dave Chinner
2019-08-13 16:35 ` Mikulas Patocka
2019-08-14 10:43 ` Dave Chinner
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=20190808135329.GG5482@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=agk@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=dm-devel@redhat.com \
--cc=honglei.wang@oracle.com \
--cc=junxiao.bi@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=msnitzer@redhat.com \
--cc=viro@zeniv.linux.org.uk \
/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).