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: Wed, 15 Jan 2025 10:37:08 +0800 [thread overview]
Message-ID: <Z4cfVBrd9OJiYYG-@fedora> (raw)
In-Reply-To: <Z4UsPor30ss0ML9s@fedora>
On Mon, Jan 13, 2025 at 11:07:42PM +0800, Ming Lei wrote:
> On Mon, Jan 13, 2025 at 05:49:43AM -0800, Christoph Hellwig wrote:
> > On Mon, Jan 13, 2025 at 05:24:46PM +0800, Ming Lei wrote:
> > > > Please state the locks. Nothing fs internal here, that report is
> > > > about i_rwsem. And a false positive because it is about ordering
> > > > of i_rwsem on the upper file system sitting on the loop device vs the
> > > > one on the lower file systems sitting below the block device. These
> > > > obviously can't deadlock, we just need to tell lockdep about that fact.
> > >
> > > How can you guarantee that some code won't submit IO by grabbing the
> > > i_rwsem?
> >
> > ? A lot of the I/O will grab i_rwsem on the underlying device.
> > Basically all writes, and for many file systems also on reads. But
> > that is an entirely different i_rwsem as the one held the bio submitter
> > as that is in different file system. There is no way the top file
> > system can lock i_rwsem on the lower file system except through the
> > loop driver, and that always sits below the freeze protection.
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).
So it is not one false positive.
> >
> > > As I explained, it is fine to move out vfs_fsync() out of freeze queue.
> > >
> > > Actually any lock which depends on freeze queue needs to take a careful
> > > look, because freeze queue connects too many global/sub-system locks.
> >
> > For block layer locks: absolutely. For file systems lock: not at all,
> > because we're talking about different file systems instances. The only
> > exception would be file systems taking global locks in the I/O path,
> > but I sincerely hope no one does that.
>
> Didn't you see the report on fs_reclaim and sysfs root lock?
>
> https://lore.kernel.org/linux-block/197b07435a736825ab40dab8d91db031c7fce37e.camel@linux.intel.com/
There are more, such as mm->mmap_lock[1], hfs SB 'cat_tree' lock[2]...
[1] https://lore.kernel.org/linux-block/67863050.050a0220.216c54.006f.GAE@google.com/
[2] https://lore.kernel.org/linux-block/67582202.050a0220.a30f1.01cb.GAE@google.com/
Thanks,
Ming
next prev parent reply other threads:[~2025-01-15 2:37 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 [this message]
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=Z4cfVBrd9OJiYYG-@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.