[systemd-devel] [PATCH v3 2/2] udev: Skip ping if timeout is 0

David Herrmann dh.herrmann at gmail.com
Mon Apr 20 09:56:14 PDT 2015


Hi

On Sun, Apr 19, 2015 at 2:41 AM, Nir Soffer <nirsof at gmail.com> wrote:
> When running udevadm settle --timeout=0, udev_ctrl_send_ping always
> times out, and settle returns 0 without checking the queue.
>
> Now we skip ping in this case, and return the queue state.
> ---
>  src/udev/udevadm-settle.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c
> index 437c794..614768f 100644
> --- a/src/udev/udevadm-settle.c
> +++ b/src/udev/udevadm-settle.c
> @@ -102,7 +102,7 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) {
>          deadline = now(CLOCK_MONOTONIC) + timeout * USEC_PER_SEC;
>
>          /* guarantee that the udev daemon isn't pre-processing */
> -        if (getuid() == 0) {
> +        if (timeout > 0 && getuid() == 0) {
>                  struct udev_ctrl *uctrl;
>
>                  uctrl = udev_ctrl_new(udev);

This looks wrong to me. With this change, we suddenly skip the
validity check that ping was created for. I don't really see why the
udev_ctrl_ping() needs to follow the udev-queue timeout. I mean, this
is really a synchronous call into udev, which really should return in
a suitable timespan. Otherwise, something is really broken.

I think this should pass something like max(timeout, 1) to
udev_ctrl_ping(), so we have at least a 1s timeout.

Thanks
David


More information about the systemd-devel mailing list