chiark / gitweb /
core: rework device state logic
authorLennart Poettering <lennart@poettering.net>
Fri, 27 Feb 2015 20:55:08 +0000 (21:55 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 28 Feb 2015 16:38:38 +0000 (17:38 +0100)
commit628c89cc68ab96fce2de7ebba5933725d147aecc
tree0ad23950d2ff4895b0de0c4163baa9be8617c4e3
parent1a1db450e54c549382e8466130e63b91ae78b552
core: rework device state logic

This change introduces a new state "tentative" for device units. Device
units are considered "plugged" when udev announced them, "dead" when
they are not available in the kernel, and "tentative" when they are
referenced in /proc/self/mountinfo or /proc/swaps but not (yet)
announced via udev.

This should fix a race when device nodes (like loop devices) are created
and immediately mounted. Previously, systemd might end up seeing the
mount unit before the device, and would thus pull down the mount because
its BindTo dependency on the device would not be fulfilled.
src/core/device.c
src/core/device.h
src/core/mount.c
src/core/swap.c
src/core/swap.h
src/core/unit.c