Blame SOURCES/lvm2-2_03_13-devices-don-t-use-deleted-loop-backing-file-for-devi.patch

4aaf76
 lib/device/device_id.c | 6 +++++-
4aaf76
 1 file changed, 5 insertions(+), 1 deletion(-)
4aaf76
4aaf76
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
4aaf76
index 67f72e5..1b98487 100644
4aaf76
--- a/lib/device/device_id.c
4aaf76
+++ b/lib/device/device_id.c
4aaf76
@@ -325,8 +325,12 @@ const char *device_id_system_read(struct cmd_context *cmd, struct device *dev, u
4aaf76
 	else if (idtype == DEV_ID_TYPE_MD_UUID)
4aaf76
 		_read_sys_block(cmd, dev, "md/uuid", sysbuf, sizeof(sysbuf));
4aaf76
 
4aaf76
-	else if (idtype == DEV_ID_TYPE_LOOP_FILE)
4aaf76
+	else if (idtype == DEV_ID_TYPE_LOOP_FILE) {
4aaf76
 		_read_sys_block(cmd, dev, "loop/backing_file", sysbuf, sizeof(sysbuf));
4aaf76
+		/* if backing file is deleted, fall back to devname */
4aaf76
+		if (strstr(sysbuf, "(deleted)"))
4aaf76
+			sysbuf[0] = '\0';
4aaf76
+	}
4aaf76
 
4aaf76
 	else if (idtype == DEV_ID_TYPE_DEVNAME) {
4aaf76
 		if (!(idname = strdup(dev_name(dev))))