Skip to contentSkip to conversation

udev + libbklid: synchronized uevent handling between kernel and ueventd?

DISCUSSION Qu Wenruo 1 participant 1 message Jul 7, 2014 Util-Linux package

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

Hi,

If I understand right, when kernel sends a KOBJ_CHANGE uevent, udevd catches it and update the ctime/mtime of the device file in /dev according to the uevent. Do I understand the procedure right?

Then a problem occurs to me that, the above procedure is asynchronized,
so sometimes concurreny may happen when kernel send the uevent but udev has
not yet updated the ctime/mtime of device file, making libblkid cache still valid and gives wrong result. (bringing the old thread again: http://www.spinics.net/lists/util-linux-ng/msg09154.html)

So i'm wondering is there some synchronized method to send uevent and wait for it completed? Currently I use a method that opens and updates ctime/mtime in kernel spaces, but it's somewhat ugly.
Hope there will be some elegent method.

Thanks,
Qu