[systemd-devel] [PATCH] rules: mark loop device as SYSTEMD_READY=0 if no file is attached

Peter Rajnoha prajnoha at redhat.com
Thu Mar 6 00:16:38 PST 2014


Hi!

Based on SYSTEMD_READY definition, I think we should also mark loop
devices with no file attached as not ready:

    rules: mark loop device as SYSTEMD_READY=0 if no file is attached

    Check existence of loop/backing_file in sysfs and mark loop
    devices with SYSTEMD_READY if missing. Such loop files is
    uninitialized and it's not ready for use yet (there's no file
    attached).
---
 rules/99-systemd.rules.in | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in
index 021359a..6ed4f3c 100644
--- a/rules/99-systemd.rules.in
+++ b/rules/99-systemd.rules.in
@@ -25,6 +25,9 @@ SUBSYSTEM=="block", ENV{DEVTYPE}=="disk",
KERNEL=="md*", ATTR{md/array_state}=="
 # Ignore nbd devices in the "add" event, with "change" the nbd is ready
 ACTION=="add", SUBSYSTEM=="block", KERNEL=="nbd*", ENV{SYSTEMD_READY}="0"

+# Ignore loop devices that don't have any file attached
+ACTION=="add|change", KERNEL=="loop[0-9]*", TEST!="loop/backing_file",
ENV{SYSTEMD_READY}="0"
+
 # We need a hardware independent way to identify network devices. We
 # use the /sys/subsystem path for this. Current vanilla kernels don't
 # actually support that hierarchy right now, however upcoming kernels


More information about the systemd-devel mailing list