From: Michal Sekletar Date: Fri, 23 Jun 2017 00:29:15 +0000 (+0200) Subject: core: unset sysfs path after transition to dead state (#6174) X-Git-Tag: v234~112 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=05e33aa1d5c074df863d9de4bf236dd676347a4c;p=platform%2Fupstream%2Fsystemd.git core: unset sysfs path after transition to dead state (#6174) Device is gone and most likely it will get garbage collected. However in cases when it doesn't get gc'ed (because it is referenced by some other unit, e.g. mount from fstab) we need to unset sysfs. This is because when device appears next time, possibly, with different sysfs path we need to update the sysfs path. Current code could end up caching stale sysfs path forever. In reality this is not a problem for normal disks (unless you swap them during system runtime). However this issue causes failures to mount filesystems on LVM where sysfs path depends on activation order (i.e. logical volumes from volume group that is activated first get assigned lower dm-X numbers and corresponding syspaths). Fixes #6126. --- diff --git a/src/core/device.c b/src/core/device.c index da008f6..77601c5 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -501,12 +501,16 @@ static void device_update_found_one(Device *d, bool add, DeviceFound found, bool * 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 int device_update_found_by_sysfs(Manager *m, const char *sysfs, bool add, DeviceFound found, bool now) {