diff options
| author | Yu Kuai <yukuai3@huawei.com> | 2023-02-17 10:21:59 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-17 08:50:20 +0100 |
| commit | 573e58f5e7e136eb82f9b4a708db87839cb7c91e (patch) | |
| tree | 48ffceb2676cba51c871d4bdcb8f2b22c9c8b7de /block/genhd.c | |
| parent | 783c225e910fa5e0ef7bd9de88d32c0787e04e95 (diff) | |
| download | linux-573e58f5e7e136eb82f9b4a708db87839cb7c91e.tar.gz linux-573e58f5e7e136eb82f9b4a708db87839cb7c91e.tar.bz2 linux-573e58f5e7e136eb82f9b4a708db87839cb7c91e.zip | |
block: Revert "block: Do not reread partition table on exclusively open device"
[ Upstream commit 0f77b29ad14e34a89961f32edc87b92db623bb37 ]
This reverts commit 36369f46e91785688a5f39d7a5590e3f07981316.
This patch can't fix the problem in a corner case that device can be
opened exclusively after the checking and before blkdev_get_by_dev().
We'll use a new solution to fix the problem in the next patch, and
the new solution doesn't need to change apis.
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Acked-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230217022200.3092987-2-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Stable-dep-of: e5cfefa97bcc ("block: fix scan partition for exclusively open device again")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'block/genhd.c')
| -rw-r--r-- | block/genhd.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/block/genhd.c b/block/genhd.c index c4765681a8b4..647f7d8d8831 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -356,7 +356,7 @@ void disk_uevent(struct gendisk *disk, enum kobject_action action) } EXPORT_SYMBOL_GPL(disk_uevent); -int disk_scan_partitions(struct gendisk *disk, fmode_t mode, void *owner) +int disk_scan_partitions(struct gendisk *disk, fmode_t mode) { struct block_device *bdev; @@ -366,9 +366,6 @@ int disk_scan_partitions(struct gendisk *disk, fmode_t mode, void *owner) return -EINVAL; if (disk->open_partitions) return -EBUSY; - /* Someone else has bdev exclusively open? */ - if (disk->part0->bd_holder && disk->part0->bd_holder != owner) - return -EBUSY; set_bit(GD_NEED_PART_SCAN, &disk->state); bdev = blkdev_get_by_dev(disk_devt(disk), mode, NULL); @@ -503,7 +500,7 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk, bdev_add(disk->part0, ddev->devt); if (get_capacity(disk)) - disk_scan_partitions(disk, FMODE_READ, NULL); + disk_scan_partitions(disk, FMODE_READ); /* * Announce the disk and partitions after all partitions are |
