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

2015-04-20 Thread David Herrmann
Hi

On Sun, Apr 19, 2015 at 2:41 AM, Nir Soffer  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
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2015-04-18 Thread Nir Soffer
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);
-- 
1.9.3

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel