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