]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: call btrfs_close_devices() from ->kill_sb
authorChristoph Hellwig <hch@lst.de>
Wed, 11 Jun 2025 10:03:00 +0000 (12:03 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 22:06:19 +0000 (00:06 +0200)
commit9f43d0ff55e306aed9fa95c79ed372d530471382
tree0762e77df141be5dac9edc1032bac708cacc81a7
parent2936a6ac8d976f3c4de6fb5fbc00c5905c0cfec7
btrfs: call btrfs_close_devices() from ->kill_sb

Although btrfs is not yet implementing blk_holder_ops, there is a
requirement for proper blk_holder_ops:

- blkdev_put() must not be called under sb->s_umount
  The blkdev_put()/bdev_fput() must not be called under sb->s_umount to
  avoid lock order reversal with disk->open_mutex.
  This is for the proper blk_holder_ops callbacks.

  Currently we're fine because we call regular fput() which defers the
  blk holder reclaiming.

To prepare for the future of blk_holder_ops, move the
btrfs_close_devices() calls into btrfs_free_fs_info().

That will be called from kill_sb() callbacks, which is also called for
error handing during mount failures, or there is already an existing
super block.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c
fs/btrfs/super.c