Support sysfs changes in the Linux 5.15 kernel.
DM_DEV_CREATE no longer creates sysfs nodes. Note this in ueventd and
add some helper APIs to libdm, so devices can be created with a
placeholder table.
This also fixes a bug in dmctl where the detailed info on suspended
devices was wrong.
Bug: 259328366
Test: dmctl with "uevents" tool
Change-Id: I822f8010e48d32841aa0ee508822f76d03a3dd85
diff --git a/init/devices.cpp b/init/devices.cpp
index 28406f6..8bc6e52 100644
--- a/init/devices.cpp
+++ b/init/devices.cpp
@@ -470,7 +470,11 @@
MakeDevice(devpath, block, major, minor, links);
}
- // We don't have full device-mapper information until a change event is fired.
+ // Handle device-mapper nodes.
+ // On kernels <= 5.10, the "add" event is fired on DM_DEV_CREATE, but does not contain name
+ // information until DM_TABLE_LOAD - thus, we wait for a "change" event.
+ // On kernels >= 5.15, the "add" event is fired on DM_TABLE_LOAD, followed by a "change"
+ // event.
if (action == "add" || (action == "change" && StartsWith(devpath, "/dev/block/dm-"))) {
for (const auto& link : links) {
if (!mkdir_recursive(Dirname(link), 0755)) {