[systemd-devel] [PATCH] core: don't change removed devices to state "tentative" [was: Re: [PATCH] unit: When stopping due to BindsTo=, log which unit caused it]
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Sun Mar 15 19:38:14 PDT 2015
On Fri, Mar 13, 2015 at 08:35:59AM +0100, Martin Pitt wrote:
> Subject: [PATCH] core: don't change removed devices to state "tentative"
>
> Commit 628c89c introduced the "tentative" device state, which caused devices to
> go from "plugged" to "tentative" on a remove uevent. This breaks the cleanup
> of stale mounts (see commit 3b48ce4), as that only applies to "dead" devices.
>
> The "tentative" state only really makes sense on adding a device when we don't
> know where it was coming from (i. e. not from udev). But when we get a device
> removal from udev we definitively know that it's gone, so change the device
> state back to "dead" as before 628c89c.
Looks good. (Lennart is travelling, so please just go ahead and push.)
Zbyszek
> diff --git a/src/core/device.c b/src/core/device.c
> index 6b489a4..098a000 100644
> --- a/src/core/device.c
> +++ b/src/core/device.c
> @@ -419,7 +419,7 @@ static void device_update_found_one(Device *d, bool add, DeviceFound found, bool
> if (now) {
> if (d->found & DEVICE_FOUND_UDEV)
> device_set_state(d, DEVICE_PLUGGED);
> - else if (d->found != DEVICE_NOT_FOUND)
> + else if (add && d->found != DEVICE_NOT_FOUND)
> device_set_state(d, DEVICE_TENTATIVE);
> else
> device_set_state(d, DEVICE_DEAD);
More information about the systemd-devel
mailing list