summaryrefslogtreecommitdiffstats
path: root/rules.d
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-07-21 03:26:13 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-08-10 00:05:47 +0200
commit7a05926fbe6ed92e60e0afc9857ced91a532f791 (patch)
tree60bdda95a2e2ed931d78704a2c34a72c1d5769cd /rules.d
parentMerge pull request #28734 from loongarch64/dev-wu-main (diff)
downloadsystemd-7a05926fbe6ed92e60e0afc9857ced91a532f791.tar.xz
systemd-7a05926fbe6ed92e60e0afc9857ced91a532f791.zip
udev: re-introduce symlinks for loopback block device
But the directories are changed from /dev/loop/by-ref/ -> /dev/disk/by-loop-ref/ and /dev/loop/by-inode/ -> /dev/disk/by-loop-inode/. As /dev/loop/ is used by losetup command for other purpose. See issue #28475. This effectively reverts commits 9915cc60868c77e7e8cecb669ddb90516dffc7df, 5022fab15fc16204d163883ca818fd6092dc919c, and c0d998248e10e1dcf18108fdbb70f259acd452eb.
Diffstat (limited to 'rules.d')
-rw-r--r--rules.d/60-persistent-storage.rules.in9
1 files changed, 9 insertions, 0 deletions
diff --git a/rules.d/60-persistent-storage.rules.in b/rules.d/60-persistent-storage.rules.in
index d5e0f5f705..39a6555045 100644
--- a/rules.d/60-persistent-storage.rules.in
+++ b/rules.d/60-persistent-storage.rules.in
@@ -161,4 +161,13 @@ ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/
# the right device, to access specific disks in a race-free fashion)
ENV{DISKSEQ}=="?*", ENV{ID_IGNORE_DISKSEQ}!="1", SYMLINK+="disk/by-diskseq/$env{DISKSEQ}$env{.PART_SUFFIX}"
+# Create symlinks that allow referencing loopback devices by their backing file's inode number
+ENV{ID_LOOP_BACKING_DEVICE}!="", ENV{ID_LOOP_BACKING_INODE}!="", SYMLINK+="disk/by-loop-inode/$env{ID_LOOP_BACKING_DEVICE}-$env{ID_LOOP_BACKING_INODE}$env{.PART_SUFFIX}"
+
+# Similar, but uses the .lo_file_name field of the loopback device (note that
+# this is basically just a free-form string passed from userspace to the kernel
+# when the device is created, it is not necessarily a file system path like the
+# "loop/backing_file" sysfs attribute, which is always an absolute path)
+ENV{ID_LOOP_BACKING_FILENAME_ENC}!="", SYMLINK+="disk/by-loop-ref/$env{ID_LOOP_BACKING_FILENAME_ENC}$env{.PART_SUFFIX}"
+
LABEL="persistent_storage_end"