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