btrfs: call bdev_fput() to reclaim the blk_holder immediately
authorQu Wenruo <wqu@suse.com>
Mon, 16 Jun 2025 00:12:20 +0000 (09:42 +0930)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 22:06:19 +0000 (00:06 +0200)
commitde339cbfb4027957304174321945d30a3f54e6f5
tree74205c35bc0b8f2694ceaceec4068392b4d2d8c8
parent9f43d0ff55e306aed9fa95c79ed372d530471382
btrfs: call bdev_fput() to reclaim the blk_holder immediately

As part of the preparation for btrfs blk_holder_ops, we want to ensure
the holder of a block device has a proper lifespan.

However btrfs is always using fput() to close a block device, which has
one problem:

- fput() is deferred
  Meaning we can have a block device with invalid (aka, freed) holder.

To avoid the problem and align the behavior to other code, just call
bdev_fput() instead.

There is some extra requirement on the locking, but that's all resolved
by previous patches and we should be safe to call bdev_fput().

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/dev-replace.c
fs/btrfs/ioctl.c
fs/btrfs/volumes.c