From 77e136f08d115f3bcf1fcf8abb1ff666ae009bef Mon Sep 17 00:00:00 2001 From: Rusty Bird Date: Tue, 12 Jul 2016 17:56:21 +0000 Subject: [PATCH] block: add no_part_scan module parameter --- ...ck-add-no_part_scan-module-parameter.patch | 49 +++++++++++++++++++ series.conf | 1 + 2 files changed, 50 insertions(+) create mode 100644 patches.qubes/0001-block-add-no_part_scan-module-parameter.patch diff --git a/patches.qubes/0001-block-add-no_part_scan-module-parameter.patch b/patches.qubes/0001-block-add-no_part_scan-module-parameter.patch new file mode 100644 index 0000000..365db84 --- /dev/null +++ b/patches.qubes/0001-block-add-no_part_scan-module-parameter.patch @@ -0,0 +1,49 @@ +From 19cb7d4e4efe39ef6ec8b216a254d83a1257846c Mon Sep 17 00:00:00 2001 +From: Rusty Bird +Date: Mon, 11 Jul 2016 13:05:38 +0000 +Subject: [PATCH] block: add no_part_scan module parameter + +Define a boolean module parameter named "no_part_scan" defaulting to N, +which, if set to Y, always causes the GENHD_FL_NO_PART_SCAN flag to be +added to subsequently created block devices, thereby disabling the +kernel's various partition table parsers for them. + +The parameter's current value can be changed at any time by writing to +the /sys/module/block/parameters/no_part_scan file. +--- + block/genhd.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/block/genhd.c b/block/genhd.c +index 9f42526..85b71f5 100644 +--- a/block/genhd.c ++++ b/block/genhd.c +@@ -572,6 +572,15 @@ exit: + disk_part_iter_exit(&piter); + } + ++/* copied (not moved) from far down below, to have fewer patch hunks */ ++#undef MODULE_PARAM_PREFIX ++#define MODULE_PARAM_PREFIX "block." ++ ++/* partition scanning policy */ ++static bool disk_no_part_scan = 0; ++module_param_named(no_part_scan, disk_no_part_scan, bool, S_IRUGO|S_IWUSR); ++MODULE_PARM_DESC(no_part_scan, "When adding block devices, always mark them as not to be scanned for partitions"); ++ + /** + * add_disk - add partitioning information to kernel list + * @disk: per-device partitioning information +@@ -587,6 +596,9 @@ void add_disk(struct gendisk *disk) + dev_t devt; + int retval; + ++ if (disk_no_part_scan) ++ disk->flags |= GENHD_FL_NO_PART_SCAN; ++ + /* minors == 0 indicates to use ext devt from part0 and should + * be accompanied with EXT_DEVT flag. Make sure all + * parameters make sense. +-- +2.5.5 + diff --git a/series.conf b/series.conf index 985ea2b..dd6f097 100644 --- a/series.conf +++ b/series.conf @@ -12,6 +12,7 @@ patches.xen/pvops-blkfront-removable-flag.patch patches.xen/pvops-blkfront-eject-support.patch patches.qubes/usbip-disable-not-implemented-error.patch +patches.qubes/0001-block-add-no_part_scan-module-parameter.patch # Security fixes patches.xen/xsa155-linux-0008-xen-Add-RING_COPY_RESPONSE.patch