Submitted By: DJ Lucas Date: 2011-05-18 Initial Package Version: 168 Upstream Status: comitted Origin: http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=2738ec2cf721db0c0deac2ba0abdc73cf7739e9f and http://git.kernel.org/?p=linux/hotplug/udev.git;a=patch;h=12f79fb0b9c919787d8a7d4307895d3d6b4b029b Description: Fixes udevadm settle behavior. diff -Nuar udev-168-orig/udev/udevd.c udev-168/udev/udevd.c --- udev-168-orig/udev/udevd.c 2011-04-21 07:05:13.000000000 -0500 +++ udev-168/udev/udevd.c 2011-05-18 11:14:54.000000000 -0500 @@ -1408,6 +1408,13 @@ udev_monitor_set_receive_buffer_size(monitor, 128*1024*1024); + /* create queue file before signalling 'ready', to make sure we block 'settle' */ + udev_queue_export = udev_queue_export_new(udev); + if (udev_queue_export == NULL) { + err(udev, "error creating queue file\n"); + goto exit; + } + if (daemonize) { pid_t pid; int fd; @@ -1421,8 +1428,8 @@ rc = 4; goto exit; default: - rc = 0; - goto exit; + rc = EXIT_SUCCESS; + goto exit_keep_queue; } setsid(); @@ -1521,12 +1528,6 @@ goto exit; } - udev_queue_export = udev_queue_export_new(udev); - if (udev_queue_export == NULL) { - err(udev, "error creating queue file\n"); - goto exit; - } - memset(&ep_ctrl, 0, sizeof(struct epoll_event)); ep_ctrl.events = EPOLLIN; ep_ctrl.data.fd = fd_ctrl; @@ -1708,9 +1709,10 @@ } } - udev_queue_export_cleanup(udev_queue_export); - rc = 0; + rc = EXIT_SUCCESS; exit: + udev_queue_export_cleanup(udev_queue_export); +exit_keep_queue: if (fd_ep >= 0) close(fd_ep); worker_list_cleanup(udev); diff -Nuar udev-168-orig/libudev/libudev-queue-private.c udev-168/libudev/libudev-queue-private.c --- udev-168-orig/libudev/libudev-queue-private.c 2011-04-07 18:09:20.000000000 -0500 +++ udev-168/libudev/libudev-queue-private.c 2011-05-18 11:14:59.000000000 -0500 @@ -103,9 +103,10 @@ { char filename[UTIL_PATH_SIZE]; + if (udev_queue_export == NULL) + return; util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.tmp", NULL); unlink(filename); - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.bin", NULL); unlink(filename); }