lkml.org 
[lkml]   [2018]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] block: Add a check for fdisk
Date
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
\
 
 \ /
  Last update: 2018-08-30 11:13    [W:3.348 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site