Re: [PATCH 16/31] block: use the holder as indication for exclusive opens

Hannes Reinecke
2023-06-07T12:29:17Z

On 6/6/23 09:39, Christoph Hellwig wrote:
> The current interface for exclusive opens is rather confusing as it
> requires both the FMODE_EXCL flag and a holder. Remove the need to pass
> FMODE_EXCL and just key off the exclusive open off a non-NULL holder.
>
> For blkdev_put this requires adding the holder argument, which provides
> better debug checking that only the holder actually releases the hold,
> but at the same time allows removing the now superfluous mode argument.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> block/bdev.c | 37 ++++++++++++++++------------
> block/fops.c | 6 +++--
> block/genhd.c | 5 ++--
> block/ioctl.c | 5 ++--
> drivers/block/drbd/drbd_nl.c | 23 ++++++++++-------
> drivers/block/pktcdvd.c | 13 +++++-----
> drivers/block/rnbd/rnbd-srv.c | 4 +--
> drivers/block/xen-blkback/xenbus.c | 2 +-
> drivers/block/zram/zram_drv.c | 8 +++---
> drivers/md/bcache/super.c | 15 ++++++------
> drivers/md/dm.c | 6 ++---
> drivers/md/md.c | 38 +++++++++++++++--------------
> drivers/mtd/devices/block2mtd.c | 4 +--
> drivers/nvme/target/io-cmd-bdev.c | 2 +-
> drivers/s390/block/dasd_genhd.c | 2 +-
> drivers/target/target_core_iblock.c | 6 ++---
> drivers/target/target_core_pscsi.c | 8 +++---
> fs/btrfs/dev-replace.c | 6 ++---
> fs/btrfs/ioctl.c | 12 ++++-----
> fs/btrfs/volumes.c | 28 ++++++++++-----------
> fs/btrfs/volumes.h | 6 ++---
> fs/erofs/super.c | 7 +++---
> fs/ext4/super.c | 11 +++------
> fs/f2fs/super.c | 2 +-
> fs/jfs/jfs_logmgr.c | 6 ++---
> fs/nfs/blocklayout/dev.c | 4 +--
> fs/nilfs2/super.c | 6 ++---
> fs/ocfs2/cluster/heartbeat.c | 4 +--
> fs/reiserfs/journal.c | 19 +++++++--------
> fs/reiserfs/reiserfs.h | 1 -
> fs/super.c | 20 +++++++--------
> fs/xfs/xfs_super.c | 15 ++++++------
> include/linux/blkdev.h | 2 +-
> kernel/power/hibernate.c | 12 +++------
> kernel/power/power.h | 2 +-
> kernel/power/swap.c | 21 +++++++---------
> mm/swapfile.c | 7 +++---
> 37 files changed, 183 insertions(+), 192 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes