linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: 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: Mon, 13 Jan 2025 16:22:51 +0800	[thread overview]
Message-ID: <Z4TNW2PYyPUqwLaD@fedora> (raw)
In-Reply-To: <Z4Spc75EiBXowzMu@infradead.org>

On Sun, Jan 12, 2025 at 09:49:39PM -0800, Christoph Hellwig wrote:
> On Mon, Jan 13, 2025 at 10:24:26AM +0800, Ming Lei wrote:
> > If vfs_flush() is called with queue frozen, the queue freeze lock may be
> > connected with FS internal lock
> 
> What "FS internal lock" ?

Please see the report:

https://lore.kernel.org/linux-block/359BC288-B0B1-4815-9F01-3A349B12E816@m.fudan.edu.cn/T/#u

> 
> > , and potential deadlock could be
> > triggered.
> > 
> > Fix it by moving vfs_flush() out of queue freezing.
> 
> That doesn't work.  The pagecache will be dirties by any command
> processed using buffered I/O, so we need to freeze first to ensure
> that there are no outstanding commands.

vfs_flush() is called in case of previous buffered IO for flushing dirty
pages.

The call from loop_change_fd() has been broken, because ->lo_backing_file
is updated to new one when calling loop_update_dio(), and I will cover
this case in V2.

For others in which backing file isn't changed, the patch is just fine
in case of new buffered IO mode, isn't it?


Thanks,
Ming


  reply	other threads:[~2025-01-13  8:23 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 [this message]
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
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=Z4TNW2PYyPUqwLaD@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=huk23@m.fudan.edu.cn \
    --cc=jjtan24@m.fudan.edu.cn \
    --cc=linux-block@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).