summary refs log tree commit diff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-04-23 14:46:20 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2021-04-23 14:46:20 -0700
commit95838bd9fcfaa12452dc9fd6d6920faef6bb5a46 (patch)
tree46035e354304a30bee3baa8852a1ac5e6ea8e7d6
parent6d1d45cb98347dbd101b378d11b5f0deb87b345d (diff)
parent68e6582e8f2dc32fd2458b9926564faa1fb4560e (diff)
downloadlinux-95838bd9fcfaa12452dc9fd6d6920faef6bb5a46.tar.gz
Merge tag 'block-5.12-2021-04-23' of git://git.kernel.dk/linux-block
Pull block fix from Jens Axboe:
 "A single fix for a behavioral regression in this series, when
  re-reading the partition table with partitions open"

* tag 'block-5.12-2021-04-23' of git://git.kernel.dk/linux-block:
  block: return -EBUSY when there are open partitions in blkdev_reread_part
-rw-r--r--block/ioctl.c2
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