All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: Add a check for fdisk
@ 2018-08-30  7:07 ? ?
  0 siblings, 0 replies; 2+ messages in thread
From: ? ? @ 2018-08-30  7:07 UTC (permalink / raw)
  To: axboe; +Cc: linux-block

When a block device is acquired in the form of FMODE_EXCL, I think it
should not be allowed to perform partition operations, similar to when
mount is executed.

Signed-off-by: Hua Su <zlsh007@hotmail.com>
---
 block/partition-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/partition-generic.c b/block/partition-generic.c
index 5a8975a..a8daa31 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -440,7 +440,7 @@ static int drop_partitions(struct gendisk *disk, struct=
 block_device *bdev)
 	struct hd_struct *part;
 	int res;
=20
-	if (bdev->bd_part_count || bdev->bd_super)
+	if (bdev->bd_part_count || bdev->bd_super || bdev->bd_holders)
 		return -EBUSY;
 	res =3D invalidate_partition(disk, 0);
 	if (res)
--=20
2.7.4

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

* [PATCH] block: Add a check for fdisk
@ 2018-08-30  9:11 Su Hua
  0 siblings, 0 replies; 2+ messages in thread
From: Su Hua @ 2018-08-30  9:11 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel, Su Hua

When a block device is acquired in the form of FMODE_EXCL, I think it
should not be allowed to perform partition operations, similar to when
mount is executed.

Signed-off-by: Su Hua <suhua.tanke@gmail.com>
---
 block/partition-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/partition-generic.c b/block/partition-generic.c
index 5a8975a..a8daa31 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -440,7 +440,7 @@ static int drop_partitions(struct gendisk *disk, struct block_device *bdev)
 	struct hd_struct *part;
 	int res;
 
-	if (bdev->bd_part_count || bdev->bd_super)
+	if (bdev->bd_part_count || bdev->bd_super || bdev->bd_holders)
 		return -EBUSY;
 	res = invalidate_partition(disk, 0);
 	if (res)
-- 
2.7.4

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

end of thread, other threads:[~2018-08-30  9:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-30  7:07 [PATCH] block: Add a check for fdisk ? ?
2018-08-30  9:11 Su Hua

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.