diff options
author | Christoph Hellwig <hch@lst.de> | 2019-11-14 17:34:36 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-11-14 17:43:59 +0300 |
commit | f0b870df80bc70dad432fd0c142bb709a49964f5 (patch) | |
tree | a937171d443f52ec38b6cf3cc6b602a2a6be09fc /drivers/block/loop.c | |
parent | 142fe8f4bb169e8632024d51c64653a8bf140561 (diff) | |
download | linux-f0b870df80bc70dad432fd0c142bb709a49964f5.tar.xz |
block: remove (__)blkdev_reread_part as an exported API
In general drivers should never mess with partition tables directly.
Unfortunately s390 and loop do for somewhat historic reasons, but they
can use bdev_disk_changed directly instead when we export it as they
satisfy the sanity checks we have in __blkdev_reread_part.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com> [dasd]
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/loop.c')
-rw-r--r-- | drivers/block/loop.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index ef6e251857c8..739b372a5112 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -640,7 +640,9 @@ static void loop_reread_partitions(struct loop_device *lo, { int rc; - rc = blkdev_reread_part(bdev); + mutex_lock(&bdev->bd_mutex); + rc = bdev_disk_changed(bdev, false); + mutex_unlock(&bdev->bd_mutex); if (rc) pr_warn("%s: partition scan of loop%d (%s) failed (rc=%d)\n", __func__, lo->lo_number, lo->lo_file_name, rc); @@ -1164,10 +1166,11 @@ out_unlock: * must be at least one and it can only become zero when the * current holder is released. */ - if (release) - err = __blkdev_reread_part(bdev); - else - err = blkdev_reread_part(bdev); + if (!release) + mutex_lock(&bdev->bd_mutex); + err = bdev_disk_changed(bdev, false); + if (!release) + mutex_unlock(&bdev->bd_mutex); if (err) pr_warn("%s: partition scan of loop%d failed (rc=%d)\n", __func__, lo_number, err); |