Skip to content

Commit 68e6582

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: return -EBUSY when there are open partitions in blkdev_reread_part
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: 4601b4b ("block: reopen the device in blkdev_reread_part") Reported-by: Karel Zak <kzak@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20210421160502.447418-1-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent f06c609 commit 68e6582

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

block/ioctl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ static int blkdev_reread_part(struct block_device *bdev, fmode_t mode)
8989
return -EINVAL;
9090
if (!capable(CAP_SYS_ADMIN))
9191
return -EACCES;
92+
if (bdev->bd_part_count)
93+
return -EBUSY;
9294

9395
/*
9496
* Reopen the device to revalidate the driver state and force a

0 commit comments

Comments
 (0)