linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Ming Lei <ming.lei@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Kun Hu <huk23@m.fudan.edu.cn>,
	Jiaji Qin <jjtan24@m.fudan.edu.cn>
Subject: Re: [PATCH] loop: don't call vfs_flush() with queue frozen
Date: Wed, 15 Jan 2025 01:40:21 -0800	[thread overview]
Message-ID: <Z4eChfyt15sCL8rV@infradead.org> (raw)
In-Reply-To: <Z4dwFFIb6gjAa4wd@fedora>

On Wed, Jan 15, 2025 at 04:21:40PM +0800, Ming Lei wrote:
> On Tue, Jan 14, 2025 at 11:05:00PM -0800, Christoph Hellwig wrote:
> > On Wed, Jan 15, 2025 at 10:37:08AM +0800, Ming Lei wrote:
> > > Actually some FSs may call kmalloc(GFP_KERNEL) with i_rwsem grabbed,
> > > which could call into real deadlock if IO on the loop disk is caused by
> > > the kmalloc(GFP_KERNEL).
> > 
> > Well, loop can always deadlock when the lower fs is doing allocations,
> > even without the freeze.  I'm actually kinda surprised loop doesn't
> > force a context noio as we'd really need that.
> 
> Loop does call mapping_set_gfp_mask(~(__GFP_IO|__GFP_FS)).

But that only helps with page cache allocations, not other allocations
don't in the I/O path, of which there are plenty in modern file systems.

> > And all of these are caused by not breaking the dependency loop..
> 
> Can you share how to break the dependency? Such as fs_reclaim &
> mm->mmap_lock.

fs_reclaim should not be broken.  It's a fake lockdep key annotation
the reclaim path.  Everything under it needs to be NOFS, or in case
of loop NOIO (see above).  I think mmap_lock is just an indirect chain
here, but I need to take a closer look.  A little busty this week and
only sporadically online, sorry.


  reply	other threads:[~2025-01-15  9:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13  2:24 [PATCH] loop: don't call vfs_flush() with queue frozen Ming Lei
2025-01-13  5:49 ` Christoph Hellwig
2025-01-13  8:22   ` Ming Lei
2025-01-13  9:18     ` Christoph Hellwig
2025-01-13  9:24       ` Ming Lei
2025-01-13 13:49         ` Christoph Hellwig
2025-01-13 15:07           ` Ming Lei
2025-01-15  2:37             ` Ming Lei
2025-01-15  7:05               ` Christoph Hellwig
2025-01-15  8:21                 ` Ming Lei
2025-01-15  9:40                   ` Christoph Hellwig [this message]
2025-01-14  3:21 ` Kun Hu
2025-02-18  5:39   ` Kun Hu

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=Z4eChfyt15sCL8rV@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=huk23@m.fudan.edu.cn \
    --cc=jjtan24@m.fudan.edu.cn \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    /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).