btrfs: always open the device read-only in btrfs_scan_one_device()
authorChristoph Hellwig <hch@lst.de>
Wed, 11 Jun 2025 10:02:59 +0000 (12:02 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 22:06:02 +0000 (00:06 +0200)
commitae818824a203958b326fd0a29e57aaeb166f1fbe
tree17f6cef4c4dad2ae2d35aa03a1537e221c07b9c9
parentea124ec327086325fc096abf42837dac471ac7ae
btrfs: always open the device read-only in btrfs_scan_one_device()

btrfs_scan_one_device() opens the block device only to read the super
block.  Instead of passing a blk_mode_t argument to sometimes open
it for writing, just hard code BLK_OPEN_READ as it will never write
to the device or hand the block_device out to someone else.

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/super.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h