On 11/16/20 3:58 PM, Christoph Hellwig wrote:
bd_mutex is primarily used for synchronizing the block device open and release path, which recurses from partitions to the whole disk device. The fact that we have two locks makes life unnecessarily complex due to lock order constrains. Replace the two levels of locking with a single mutex in the gendisk structure. Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- block/genhd.c | 7 ++-- block/ioctl.c | 4 +- block/partitions/core.c | 22 +++++----- drivers/block/loop.c | 14 +++---- drivers/block/xen-blkfront.c | 8 ++-- drivers/block/zram/zram_drv.c | 4 +- drivers/block/zram/zram_drv.h | 2 +- drivers/md/md.h | 7 +--- drivers/s390/block/dasd_genhd.c | 8 ++-- drivers/scsi/sd.c | 4 +- fs/block_dev.c | 71 +++++++++++++++++---------------- fs/btrfs/volumes.c | 2 +- fs/super.c | 8 ++-- include/linux/blk_types.h | 1 - include/linux/genhd.h | 1 + 15 files changed, 80 insertions(+), 83 deletions(-)
Reviewed-by: Hannes Reinecke <hare@xxxxxxx> Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@xxxxxxx +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer