All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: return -EBUSY when there are open partitions in blkdev_reread_part
@ 2021-04-21 16:05 Christoph Hellwig
  2021-04-21 16:50 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2021-04-21 16:05 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, Karel Zak

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 <kzak@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/ioctl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/ioctl.c b/block/ioctl.c
index ff241e663c018f..8ba1ed8defd0bb 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
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block: return -EBUSY when there are open partitions in blkdev_reread_part
  2021-04-21 16:05 [PATCH] block: return -EBUSY when there are open partitions in blkdev_reread_part Christoph Hellwig
@ 2021-04-21 16:50 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-04-21 16:50 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-block, Karel Zak

On 4/21/21 10:05 AM, Christoph Hellwig wrote:
> 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.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-21 16:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 16:05 [PATCH] block: return -EBUSY when there are open partitions in blkdev_reread_part Christoph Hellwig
2021-04-21 16:50 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.