diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-06-05 18:09:27 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-06-07 15:29:17 +0200 |
commit | 244f80554940a6a08b6aafea033b5547eae74db4 (patch) | |
tree | cb31ac595d9ee9e7813d425e817963382e2bd446 | |
parent | 66f3fdbb073d8263b34bd65982a7e59d09086b23 (diff) | |
download | systemd-244f80554940a6a08b6aafea033b5547eae74db4.tar.gz |
core: tighten when we unset the sysfs path of device units
Make sure that whenever we enter "dead" state we unset the sysfs path,
not just when we are changing to it due to "found" mask changes.
-rw-r--r-- | src/core/device.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/device.c b/src/core/device.c index e1f4ada87f..0615156820 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -121,6 +121,9 @@ static void device_set_state(Device *d, DeviceState state) { old_state = d->state; d->state = state; + if (state == DEVICE_DEAD) + device_unset_sysfs(d); + if (state != old_state) log_unit_debug(UNIT(d), "Changed %s -> %s", device_state_to_string(old_state), device_state_to_string(state)); @@ -599,12 +602,10 @@ static void device_found_changed(Device *d, DeviceFound previous, DeviceFound no /* If the device has not been seen by udev yet, but is now referenced by the kernel, then we assume the * kernel knows it now, and udev might soon too. */ device_set_state(d, DEVICE_TENTATIVE); - else { + else /* If nobody sees the device, or if the device was previously seen by udev and now is only referenced * from the kernel, then we consider the device is gone, the kernel just hasn't noticed it yet. */ device_set_state(d, DEVICE_DEAD); - device_unset_sysfs(d); - } } static void device_update_found_one(Device *d, DeviceFound found, DeviceFound mask) { |