9fc0f6
From 4c3ce66158917f3fff65e25b5dde622bff3ec6f8 Mon Sep 17 00:00:00 2001
9fc0f6
From: Peter Rajnoha <prajnoha@redhat.com>
9fc0f6
Date: Thu, 6 Mar 2014 15:49:55 +0100
9fc0f6
Subject: [PATCH] rules: mark loop device as SYSTEMD_READY=0 if no file is
9fc0f6
 attached
9fc0f6
9fc0f6
Check existence of loop/backing_file in sysfs and mark loop
9fc0f6
devices with SYSTEMD_READY if missing. Such loop files is
9fc0f6
uninitialized and it's not ready for use yet (there's no file
9fc0f6
attached).
9fc0f6
---
9fc0f6
 rules/99-systemd.rules.in | 3 +++
9fc0f6
 1 file changed, 3 insertions(+)
9fc0f6
9fc0f6
diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in
9fc0f6
index 0e0a567..0471719 100644
9fc0f6
--- a/rules/99-systemd.rules.in
9fc0f6
+++ b/rules/99-systemd.rules.in
9fc0f6
@@ -25,6 +25,9 @@ SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", ATTR{md/array_state}=="
9fc0f6
 # Ignore nbd devices in the "add" event, with "change" the nbd is ready
9fc0f6
 ACTION=="add", SUBSYSTEM=="block", KERNEL=="nbd*", ENV{SYSTEMD_READY}="0"
9fc0f6
 
9fc0f6
+# Ignore loop devices that don't have any file attached
9fc0f6
+ACTION=="add|change", KERNEL=="loop[0-9]*", TEST!="loop/backing_file", ENV{SYSTEMD_READY}="0"
9fc0f6
+
9fc0f6
 # We need a hardware independent way to identify network devices. We
9fc0f6
 # use the /sys/subsystem path for this. Current vanilla kernels don't
9fc0f6
 # actually support that hierarchy right now, however upcoming kernels