diff options
authorChristoph Hellwig <>2021-04-21 18:05:02 +0200
committerJens Axboe <>2021-04-21 10:49:37 -0600
commit68e6582e8f2dc32fd2458b9926564faa1fb4560e (patch)
parentf06c609645ecd043c79380fac94145926603fb33 (diff)
block: return -EBUSY when there are open partitions in blkdev_reread_partblock-5.12-2021-04-23block-5.12
The switch to go through blkdev_get_by_dev means we now ignore the return value from bdev_disk_changed in __blkdev_get. Add a manual check to restore the old semantics. Fixes: 4601b4b130de ("block: reopen the device in blkdev_reread_part") Reported-by: Karel Zak <> Signed-off-by: Christoph Hellwig <> Link: Signed-off-by: Jens Axboe <>
1 files changed, 2 insertions, 0 deletions
diff --git a/block/ioctl.c b/block/ioctl.c
index ff241e663c01..8ba1ed8defd0 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -89,6 +89,8 @@ static int blkdev_reread_part(struct block_device *bdev, fmode_t mode)
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
+ if (bdev->bd_part_count)
+ return -EBUSY;
* Reopen the device to revalidate the driver state and force a