linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Jan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@infradead.org>, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fs: Avoid grabbing sb->s_umount under bdev->bd_holder_lock
Date: Thu, 19 Oct 2023 10:33:36 +0200	[thread overview]
Message-ID: <20231019-galopp-zeltdach-b14b7727f269@brauner> (raw)
In-Reply-To: <20231018152924.3858-1-jack@suse.cz>

On Wed, Oct 18, 2023 at 05:29:24PM +0200, Jan Kara wrote:
> The implementation of bdev holder operations such as fs_bdev_mark_dead()
> and fs_bdev_sync() grab sb->s_umount semaphore under
> bdev->bd_holder_lock. This is problematic because it leads to
> disk->open_mutex -> sb->s_umount lock ordering which is counterintuitive
> (usually we grab higher level (e.g. filesystem) locks first and lower
> level (e.g. block layer) locks later) and indeed makes lockdep complain
> about possible locking cycles whenever we open a block device while
> holding sb->s_umount semaphore. Implement a function

This patches together with my series that Christoph sent out for me
Link: https://lore.kernel.org/r/20231017184823.1383356-1-hch@lst.de
two days ago (tyvm!) the lockdep false positives are all gone and we
also eliminated the counterintuitive ordering requirement that forces us
to give up s_umount before opening block devices.

I've verified that yesterday and did a bunch of testing via sudden
device removal.

Christoph had thankfully added generic/730 and generic/731 to emulate
some device removal. I also messed around with the loop code and
specifically used LOOP_CHANGE_FD to force a disk_force_media_change() on
a filesystem.

  parent reply	other threads:[~2023-10-19  8:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-18 15:29 [PATCH] fs: Avoid grabbing sb->s_umount under bdev->bd_holder_lock Jan Kara
2023-10-18 15:46 ` Christoph Hellwig
2023-10-19  8:16 ` Christian Brauner
2023-10-19  8:33 ` Christian Brauner [this message]
2023-10-19 10:57   ` Jan Kara
2023-10-20 11:18     ` Christian Brauner
2023-10-19 13:40   ` Christoph Hellwig
2023-10-20 11:31     ` Christian Brauner
2023-10-20 12:04       ` Jan Kara
2023-10-23  7:40         ` Christian Brauner
2023-10-23 15:35           ` loop change deprecation bdev->bd_holder_lock Christian Brauner
2023-10-24  7:03             ` Christoph Hellwig
2023-10-24  8:44               ` loop change deprecation Christian Brauner
2023-10-23 14:08         ` LOOP_CONFIGURE uevents Christian Brauner
2023-10-24  7:06           ` Christoph Hellwig
2023-10-24  8:42             ` Christian Brauner

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=20231019-galopp-zeltdach-b14b7727f269@brauner \
    --to=brauner@kernel.org \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --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).