lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 22 Oct 2021 14:47:47 +0800
From:   Mark-PK Tsai <mark-pk.tsai@...iatek.com>
To:     <agk@...hat.com>, <snitzer@...hat.com>, <dm-devel@...hat.com>
CC:     <matthias.bgg@...il.com>, <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-mediatek@...ts.infradead.org>, <tequila.yuang@...iatek.com>,
        <yj.chiang@...iatek.com>, <mark-pk.tsai@...iatek.com>
Subject: [PATCH] dm: add module parameter bdev_wait

dm_early_create() fail if the target block device not found in
the late init stage.
The block device is created in mmc_rescan() which kernel do
it async by queue it into system_freezable_wq.
Add module param bdev_wait to support waiting the block device
ready before dm_early_create() like prepare_namespace() does.

Signed-off-by: Mark-PK Tsai <mark-pk.tsai@...iatek.com>
---
 drivers/md/dm-init.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/md/dm-init.c b/drivers/md/dm-init.c
index b0c45c6ebe0b..a3d24cafa4f4 100644
--- a/drivers/md/dm-init.c
+++ b/drivers/md/dm-init.c
@@ -8,11 +8,13 @@
  */
 
 #include <linux/ctype.h>
+#include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/device-mapper.h>
 #include <linux/init.h>
 #include <linux/list.h>
 #include <linux/moduleparam.h>
+#include <linux/mount.h>
 
 #define DM_MSG_PREFIX "init"
 #define DM_MAX_DEVICES 256
@@ -20,6 +22,7 @@
 #define DM_MAX_STR_SIZE 4096
 
 static char *create;
+static char *bdev_wait;
 
 /*
  * Format: dm-mod.create=<name>,<uuid>,<minor>,<flags>,<table>[,<table>+][;<name>,<uuid>,<minor>,<flags>,<table>[,<table>+]+]
@@ -286,6 +289,12 @@ static int __init dm_init_init(void)
 	DMINFO("waiting for all devices to be available before creating mapped devices");
 	wait_for_device_probe();
 
+	if (bdev_wait) {
+		DMINFO("Waiting for block device %s...", bdev_wait);
+		while (!name_to_dev_t(bdev_wait))
+			msleep(5);
+	}
+
 	list_for_each_entry(dev, &devices, list) {
 		if (dm_early_create(&dev->dmi, dev->table,
 				    dev->target_args_array))
@@ -301,3 +310,5 @@ late_initcall(dm_init_init);
 
 module_param(create, charp, 0);
 MODULE_PARM_DESC(create, "Create a mapped device in early boot");
+module_param(bdev_wait, charp, 0);
+MODULE_PARM_DESC(bdev_wait, "Wait until the block device ready before dm_early_create");
-- 
2.18.0

Powered by blists - more mailing lists