zdev: Implement --no-settle

There are some situations where running "udevadm settle" can result in
a deadlock, such as in the early stages of initial RAM-disk processing.

Introduce a new command-line option --no-settle that can be used to
suppress calling "udevadm settle" to allow chzdev to be run in such
situations.

Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Peter Oberparleiter
2017-09-01 11:05:53 +02:00
committed by Jan Höppner
parent 7d355b0fec
commit f32bff9688
5 changed files with 23 additions and 0 deletions

View File

@@ -24,6 +24,7 @@
#include "udev.h"
int udev_need_settle = 0;
int udev_no_settle;
/* Create a newly allocated udev entry. */
static struct udev_entry_node *udev_entry_node_new(const char *key,
@@ -403,5 +404,7 @@ exit_code_t udev_remove_rule(const char *type, const char *id)
/* Wait for all current udev events to finish. */
void udev_settle(void)
{
if (udev_no_settle)
return;
misc_system(err_ignore, "%s settle", PATH_UDEVADM);
}