Skip to content

Support dm without udev#1036

Merged
mulkieran merged 1 commit into
stratis-storage:masterfrom
Apokleos:support-dm-without-udev
Jun 15, 2026
Merged

Support dm without udev#1036
mulkieran merged 1 commit into
stratis-storage:masterfrom
Apokleos:support-dm-without-udev

Conversation

@Apokleos

@Apokleos Apokleos commented May 12, 2026

Copy link
Copy Markdown
Contributor

It aims to address issue #1035

Summary by CodeRabbit

  • Bug Fixes

    • Device lifecycle now handles missing or disabled udev and operations that don't require udev synchronization gracefully: synchronization metadata is cleared and devices are not left incorrectly suspended.
    • Fast-path avoids errors when the udev daemon is unavailable, allowing operations to proceed without semaphore allocation and ensuring resume/remove flows complete reliably.
  • Tests

    • Added end-to-end tests covering create/load/suspend/resume/remove flows with udev disabled and when the udev daemon is not running.

@packit-as-a-service

Copy link
Copy Markdown

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo dnf install -y 'dnf*-command(copr)'
  • dnf copr enable packit/stratis-storage-devicemapper-rs-1036
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@Apokleos

Copy link
Copy Markdown
Contributor Author

Hey @mulkieran I need your help to review this PR. Really appreciate it.

@mulkieran

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6b93045d-3b36-4bcb-a7d3-ebf3ab173524

📥 Commits

Reviewing files that changed from the base of the PR and between 06e26c8 and 568a896.

📒 Files selected for processing (3)
  • src/core/dm.rs
  • src/core/dm_ioctl.rs
  • src/core/dm_udev_sync.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/core/dm_ioctl.rs
  • src/core/dm_udev_sync.rs
  • src/core/dm.rs

Walkthrough

Adds an ioctl classifier; clears hdr.event_nr for ioctls that don't use the udev cookie in DM::do_ioctl; UdevSyncAction::begin returns inactive sync (clearing event_nr) when sync isn't required or udev is unavailable; tests cover no-udev and no-udev-device lifecycle scenarios.

Changes

Udev disable and graceful fallback handling

Layer / File(s) Summary
ioctl classification helper
src/core/dm_ioctl.rs
Adds ioctl_uses_udev_cookie(ioctl: u8) -> bool to identify ioctls that use the udev/kernel cookie (DM_DEV_REMOVE_CMD, DM_DEV_RENAME_CMD, DM_DEV_SUSPEND_CMD).
DM ioctl event_nr gating
src/core/dm.rs
DM::do_ioctl now clears hdr.event_nr for ioctls that do not use the udev cookie and preserves it for those that do.
UdevSync fallback when udev is disabled or missing
src/core/dm_udev_sync.rs
UdevSyncAction::begin returns an inactive UdevSync and clears hdr.event_nr when sync is not required (ioctl doesn't use cookie, suspended variant, SysV semaphores unavailable) or when the udev socket is absent; active semaphore allocation remains unchanged.
Test coverage for no-udev lifecycle
src/core/dm.rs, src/core/dm_udev_sync.rs
Adds no_udev_dm_options() and tests that when udev is not running or udev rules are disabled, relevant ioctls yield inactive UdevSync with cleared event_nr, and a device lifecycle test verifies device resume/remove behavior with no-udev options.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

Suggested reviewers

  • jbaublitz
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding support for device-mapper operations without udev, which is the core objective across all three modified files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mulkieran

Copy link
Copy Markdown
Member

@Apokleos Thanks for the PR! Please fix the clippy error and force push to resume testing.

@mulkieran mulkieran moved this to In Review in 2026May May 12, 2026
@Apokleos Apokleos force-pushed the support-dm-without-udev branch from 2052ecc to cd043a1 Compare May 13, 2026 01:52
@Apokleos

Apokleos commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

@Apokleos Thanks for the PR! Please fix the clippy error and force push to resume testing.

Hey @mulkieran Thanks very much. I have updated the code, but I cannot run the reset CI, which I just can see

2 workflows awaiting approval
This workflow requires approval from a maintainer. 

Could you please help approve to run the CI ? appreciate it.

@mulkieran

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
src/core/dm.rs (1)

1181-1217: 💤 Low value

Test reads as a good end-to-end sanity check, one small consistency nit.

The lifecycle test correctly exercises create → table_load → resume (suspend without DM_SUSPEND) → device_info → remove with the no-udev option set, and the post-resume assertion !info.flags().contains(DmFlags::DM_SUSPEND) is a solid invariant.

One small inconsistency worth fixing while you're here: the final device_remove call rebuilds the options via no_udev_dm_options() instead of reusing the local opts you already created on Line 1188. Using opts keeps the test uniform with steps 3 and would also catch any accidental divergence if no_udev_dm_options() is later changed.

♻️ Reuse the existing options binding
-        // Step 5: Remove device with no-udev options
-        dm.device_remove(&id, no_udev_dm_options()).unwrap();
+        // Step 5: Remove device with no-udev options
+        dm.device_remove(&id, opts).unwrap();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/dm.rs` around lines 1181 - 1217, The test
sudo_test_no_udev_device_lifecycle creates a local binding opts =
no_udev_dm_options() but then calls dm.device_remove(&id, no_udev_dm_options())
instead of reusing opts; change the final dm.device_remove call to use the
existing opts variable (dm.device_remove(&id, opts).unwrap()) so the test
consistently reuses the same options and will detect any future divergence in
no_udev_dm_options().
src/core/dm_udev_sync.rs (2)

298-298: ⚡ Quick win

Dense one-liner — break out the predicate for readability.

matches!(ioctl as u32, A | B | C if *SYSV_SEM_SUPPORTED && (hdr.flags & DmFlags::DM_SUSPEND.bits()) == 0) is syntactically fine but it mixes "which ioctl?" with "is the environment usable?" and "is this actually a resume, not a suspend?" on one ~150-char line. Splitting it makes the intent (and the SUSPEND-vs-resume distinction) obvious and easier to test/maintain.

♻️ Suggested split
-            // First check if this ioctl command requires udev synchronization.
-            // Only REMOVE, RENAME, and SUSPEND (non-suspended) operations need it.
-            let requires_sync = matches!(ioctl as u32, dmi::DM_DEV_REMOVE_CMD | dmi::DM_DEV_RENAME_CMD | dmi::DM_DEV_SUSPEND_CMD if *SYSV_SEM_SUPPORTED && (hdr.flags & DmFlags::DM_SUSPEND.bits()) == 0);
+            // Only REMOVE, RENAME, and SUSPEND-as-resume operations generate
+            // udev events that we need to synchronize on, and we can only do
+            // that synchronization when the kernel supports SysV semaphores.
+            let is_udev_cookie_cmd = matches!(
+                ioctl as u32,
+                dmi::DM_DEV_REMOVE_CMD | dmi::DM_DEV_RENAME_CMD | dmi::DM_DEV_SUSPEND_CMD
+            );
+            let is_actual_suspend = (hdr.flags & DmFlags::DM_SUSPEND.bits()) != 0;
+            let requires_sync = is_udev_cookie_cmd && *SYSV_SEM_SUPPORTED && !is_actual_suspend;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/dm_udev_sync.rs` at line 298, The one-liner computing requires_sync
is dense; split the predicate into clearly named boolean temporaries to improve
readability and testability: extract checks for the ioctl type (e.g.,
is_remove_or_rename_or_suspend using ioctl and dmi::DM_DEV_REMOVE_CMD |
dmi::DM_DEV_RENAME_CMD | dmi::DM_DEV_SUSPEND_CMD), the environment support
(is_sysv_supported using *SYSV_SEM_SUPPORTED) and the suspend-vs-resume check
(is_not_resume using (hdr.flags & DmFlags::DM_SUSPEND.bits()) == 0), then set
requires_sync = is_ioctl_of_type && is_sysv_supported && is_not_resume so intent
and each condition are obvious and easy to unit test.

505-540: ⚡ Quick win

Good end-to-end coverage; consider also asserting the early-return contract.

The test validates the udev_disabled branch for the three udev-cookie ioctls and asserts the right post-conditions (cookie == 0, semid == None, event_nr == 0). Nice.

If you act on the early-return-clears-event_nr fix in the comment above, it would be worth adding a complementary case that exercises the !requires_sync path — e.g., DM_DEV_SUSPEND_CMD with hdr.flags |= DmFlags::DM_SUSPEND.bits() and udev flags set — to lock in that event_nr is also cleared there. That guards against future regressions in either path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/dm_udev_sync.rs` around lines 505 - 540, Extend the
test_udevsync_no_udev_options_all_sync_cmds test to also exercise the
early-return (non-requires_sync) path: for the DM_DEV_SUSPEND_CMD case set
hdr.flags |= DmFlags::DM_SUSPEND.bits() before calling UdevSync::begin so the
code follows the !requires_sync branch, then assert the same post-conditions
(sync.cookie == 0, sync.semid == None, and hdr.event_nr == 0) and that
sync.end(...) returns Ok; this ensures both the requires_sync and early-return
branches clear event_nr when udev is disabled.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/core/dm_udev_sync.rs`:
- Around line 295-329: The early-return in UdevSync::begin when !requires_sync
leaves hdr.event_nr non-zero in some cases (e.g. SYSV_SEM_SUPPORTED == false or
suspended DM_DEV_SUSPEND_CMD), which can send a udev cookie to the kernel
without a semaphore; modify begin (the block guarded by requires_sync / the
!requires_sync early return) to clear hdr.event_nr = 0 before returning the
inactive UdevSync (cookie 0, semid None), or refactor to always zero
hdr.event_nr before any inactive return; update the branch that currently
returns Ok(UdevSync { cookie: 0, semid: None }) when !requires_sync to match the
udev_disabled || !udev_running() path by zeroing hdr.event_nr.

In `@src/core/dm.rs`:
- Around line 131-140: Extract the repeated ioctl predicate into a single
function (e.g., is_udev_cookie_cmd(ioctl: u32) -> bool) that checks the
DM_DEV_REMOVE_CMD | DM_DEV_RENAME_CMD | DM_DEV_SUSPEND_CMD set and return true
for those that support udev cookies; replace the inline match in do_ioctl (where
hdr.event_nr is currently cleared based on ioctl) with a call to
is_udev_cookie_cmd, and also call the same is_udev_cookie_cmd from
UdevSync::begin to decide semaphore/allocation behavior so both sites use the
single source of truth.

---

Nitpick comments:
In `@src/core/dm_udev_sync.rs`:
- Line 298: The one-liner computing requires_sync is dense; split the predicate
into clearly named boolean temporaries to improve readability and testability:
extract checks for the ioctl type (e.g., is_remove_or_rename_or_suspend using
ioctl and dmi::DM_DEV_REMOVE_CMD | dmi::DM_DEV_RENAME_CMD |
dmi::DM_DEV_SUSPEND_CMD), the environment support (is_sysv_supported using
*SYSV_SEM_SUPPORTED) and the suspend-vs-resume check (is_not_resume using
(hdr.flags & DmFlags::DM_SUSPEND.bits()) == 0), then set requires_sync =
is_ioctl_of_type && is_sysv_supported && is_not_resume so intent and each
condition are obvious and easy to unit test.
- Around line 505-540: Extend the test_udevsync_no_udev_options_all_sync_cmds
test to also exercise the early-return (non-requires_sync) path: for the
DM_DEV_SUSPEND_CMD case set hdr.flags |= DmFlags::DM_SUSPEND.bits() before
calling UdevSync::begin so the code follows the !requires_sync branch, then
assert the same post-conditions (sync.cookie == 0, sync.semid == None, and
hdr.event_nr == 0) and that sync.end(...) returns Ok; this ensures both the
requires_sync and early-return branches clear event_nr when udev is disabled.

In `@src/core/dm.rs`:
- Around line 1181-1217: The test sudo_test_no_udev_device_lifecycle creates a
local binding opts = no_udev_dm_options() but then calls dm.device_remove(&id,
no_udev_dm_options()) instead of reusing opts; change the final dm.device_remove
call to use the existing opts variable (dm.device_remove(&id, opts).unwrap()) so
the test consistently reuses the same options and will detect any future
divergence in no_udev_dm_options().
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6153e97b-0b6c-465e-b973-01587aa33be3

📥 Commits

Reviewing files that changed from the base of the PR and between 0dcbf18 and cd043a1.

📒 Files selected for processing (2)
  • src/core/dm.rs
  • src/core/dm_udev_sync.rs

Comment thread src/core/dm_udev_sync.rs
Comment thread src/core/dm.rs Outdated
@mulkieran

Copy link
Copy Markdown
Member

@Apokleos Thanks for the PR! Please fix the clippy error and force push to resume testing.

Hey @mulkieran Thanks very much. I have updated the code, but I cannot run the reset CI, which I just can see

2 workflows awaiting approval
This workflow requires approval from a maintainer. 

Could you please help approve to run the CI ? appreciate it.

@Apokleos Thanks for the repush. Try running "make fmt" to fix the formatting issue and push again. I'll review the CodeRabbit remarks and let you know what I think about them.

@Apokleos Apokleos force-pushed the support-dm-without-udev branch from cd043a1 to ba8b1e5 Compare May 14, 2026 02:55
@Apokleos

Copy link
Copy Markdown
Contributor Author

@Apokleos Thanks for the PR! Please fix the clippy error and force push to resume testing.

Hey @mulkieran Thanks very much. I have updated the code, but I cannot run the reset CI, which I just can see

2 workflows awaiting approval
This workflow requires approval from a maintainer. 

Could you please help approve to run the CI ? appreciate it.

@Apokleos Thanks for the repush. Try running "make fmt" to fix the formatting issue and push again. I'll review the CodeRabbit remarks and let you know what I think about them.

@mulkieran Thanks very much for the patiance. code changes are updated now based on the CodeRabbit's advice. PTAL !

@Apokleos

Copy link
Copy Markdown
Contributor Author

Hey @mulkieran Looking forward to your input and advice about this PR. If there's some places should be fixed or corrected ? I'd like to devote myself totally to move it forward. Really appreciate it.

@Apokleos Apokleos force-pushed the support-dm-without-udev branch from ba8b1e5 to 464aa70 Compare May 19, 2026 08:17
@Apokleos

Copy link
Copy Markdown
Contributor Author

Hey @mulkieran FYI

@Apokleos Apokleos force-pushed the support-dm-without-udev branch from 464aa70 to f4f4760 Compare May 25, 2026 11:03
@Apokleos

Copy link
Copy Markdown
Contributor Author

Hey @mulkieran Looking forward to your feedback.

Apokleos added a commit to Apokleos/kata-containers that referenced this pull request May 26, 2026
The kata guest VM runs without udev, so device-mapper nodes under
/dev/mapper are never created automatically. Add the foundational
helpers that subsequent dm-verity integration will rely on:

It focus on the following key points:
(1) DmOptions builders that disable all udev synchronization flags,
  with read-only and deferred-remove variants.
(2) mknod-based device node creation/removal under /dev/mapper, since
  devtmpfs nodes are not auto-created without udev.

Also add the devicemapper crate dependency (default-features = false).

But note that the commit depends on device mapper with no-udev support
with the PR:stratis-storage/devicemapper-rs#1036

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
@mulkieran

Copy link
Copy Markdown
Member

@Apokleos Thank you for keeping PR up-to-date. I hope to be able to give you a aresponse next week.

Apokleos added a commit to Apokleos/kata-containers that referenced this pull request May 27, 2026
The kata guest VM runs without udev, so device-mapper nodes under
/dev/mapper are never created automatically. Add the foundational
helpers that subsequent dm-verity integration will rely on:

It focus on the following key points:
(1) DmOptions builders that disable all udev synchronization flags,
  with read-only and deferred-remove variants.
(2) mknod-based device node creation/removal under /dev/mapper, since
  devtmpfs nodes are not auto-created without udev.

Also add the devicemapper crate dependency (default-features = false).

But note that the commit depends on device mapper with no-udev support
with the PR:stratis-storage/devicemapper-rs#1036

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
@Apokleos Apokleos force-pushed the support-dm-without-udev branch from f4f4760 to f38c213 Compare June 1, 2026 12:32
@mulkieran mulkieran removed this from 2026May Jun 1, 2026
Apokleos added a commit to kata-containers/kata-containers that referenced this pull request Jun 11, 2026
The kata guest VM runs without udev, so device-mapper nodes under
/dev/mapper are never created automatically. Add the foundational
helpers that subsequent dm-verity integration will rely on:

It focus on the following key points:
(1) DmOptions builders that disable all udev synchronization flags,
  with read-only and deferred-remove variants.
(2) mknod-based device node creation/removal under /dev/mapper, since
  devtmpfs nodes are not auto-created without udev.

Also add the devicemapper crate dependency (default-features = false).

But note that the commit depends on device mapper with no-udev support
with the PR:stratis-storage/devicemapper-rs#1036

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
@Apokleos Apokleos force-pushed the support-dm-without-udev branch from 06e26c8 to 568a896 Compare June 11, 2026 15:12
@Apokleos

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mulkieran mulkieran moved this from In Progress to In Review in 2026June Jun 11, 2026
@jbaublitz jbaublitz self-requested a review June 11, 2026 20:58

@jbaublitz jbaublitz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One high-level question for you @mulkieran is whether we want to include DM_UDEV_DISABLE_DM_RULES_FLAG in our private() helper.

Comment thread src/core/dm.rs
// Clear event_nr for ioctls that don't support udev cookies to avoid EINVAL
if !dmi::ioctl_uses_udev_cookie(ioctl) {
hdr.event_nr = 0;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is incorrect based on the header:


	/*
	 * event_nr holds either the event number (input and output) or the
	 * udev cookie value (input only).
	 * The DM_DEV_WAIT ioctl takes an event number as input.
	 * The DM_SUSPEND, DM_DEV_REMOVE and DM_DEV_RENAME ioctls
	 * use the field as a cookie to return in the DM_COOKIE
	 * variable with the uevents they issue.
	 * For output, the ioctls return the event number, not the cookie.
	 */

This would clear it on DM_DEV_WAIT which is also documented as accepting a value here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx @jbaublitz codes are updated, PTAL!

Comment thread src/core/dm.rs Outdated
Comment on lines +1160 to +1162
DmUdevFlags::DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG
| DmUdevFlags::DM_UDEV_DISABLE_DISK_RULES_FLAG
| DmUdevFlags::DM_UDEV_DISABLE_OTHER_RULES_FLAG

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is just for testing but we already have some of this code defined in a helper here

Comment thread src/core/dm_udev_sync.rs Outdated
Comment on lines +495 to +497
event_nr: (DmUdevFlags::DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG
| DmUdevFlags::DM_UDEV_DISABLE_DISK_RULES_FLAG
| DmUdevFlags::DM_UDEV_DISABLE_OTHER_RULES_FLAG

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here about the existing helper function.

Apokleos added a commit to kata-containers/kata-containers that referenced this pull request Jun 12, 2026
The kata guest VM runs without udev, so device-mapper nodes under
/dev/mapper are never created automatically. Add the foundational
helpers that subsequent dm-verity integration will rely on:

It focus on the following key points:
(1) DmOptions builders that disable all udev synchronization flags,
  with read-only and deferred-remove variants.
(2) mknod-based device node creation/removal under /dev/mapper, since
  devtmpfs nodes are not auto-created without udev.

Also add the devicemapper crate dependency (default-features = false).

But note that the commit depends on device mapper with no-udev support
with the PR:stratis-storage/devicemapper-rs#1036

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
@Apokleos Apokleos force-pushed the support-dm-without-udev branch from 568a896 to 8b970d9 Compare June 12, 2026 11:45

@mulkieran mulkieran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Apokleos Please do fix the clippy lint, which is very minor. You can run make clippy during development to find out ahead of time. Otherwise, looks good to me.

@jbaublitz jbaublitz self-requested a review June 12, 2026 14:12
@mulkieran mulkieran moved this from In Review to In Progress in 2026June Jun 12, 2026
Previously, UdevSync::begin() returned a hard error when udev was not
running, blocking ALL DM ioctl operations — even those that don't
require udev sync (CREATE, TABLE_LOAD, STATUS, etc.). Setting
DM_UDEV_DISABLE_LIBRARY_FALLBACK could not bypass this because the
flag was checked after the udev_running() gate.

This commit aims to address the issue with the following key changes:
(1) Clear event_nr in do_ioctl() for commands that don't carry a udev
cookie (only REMOVE, RENAME, and SUSPEND do). A non-zero event_nr on
other commands could cause the kernel to return EINVAL or wait
indefinitely for a udev completion that never arrives.

(2) Reorder UdevSync::begin() to check whether the ioctl actually
requires sync before checking udev_running(). Non-sync ioctls now
return an inactive UdevSync immediately. When sync is required but
udev is disabled or not running, clear event_nr and return inactive
instead of erroring.

(3) Extract ioctl_uses_udev_cookie(ioctl: u8) -> bool into dm_ioctl.rs as
the single source of truth, replacing duplicated match arms in do_ioctl
and UdevSync::begin.

(4) Add unit test (test_udevsync_no_udev_options_all_sync_cmds) and
integration test (sudo_test_no_udev_device_lifecycle) validating the full
dm-verity device lifecycle with all DM_UDEV_DISABLE_* flags set.

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
@Apokleos Apokleos force-pushed the support-dm-without-udev branch from 8b970d9 to 5a13a88 Compare June 13, 2026 03:42
@Apokleos

Copy link
Copy Markdown
Contributor Author

@Apokleos Please do fix the clippy lint, which is very minor. You can run make clippy during development to find out ahead of time. Otherwise, looks good to me.

Appreciate it @mulkieran updated, PTAL.

Apokleos added a commit to kata-containers/kata-containers that referenced this pull request Jun 13, 2026
The kata guest VM runs without udev, so device-mapper nodes under
/dev/mapper are never created automatically. Add the foundational
helpers that subsequent dm-verity integration will rely on:

It focus on the following key points:
(1) DmOptions builders that disable all udev synchronization flags,
  with read-only and deferred-remove variants.
(2) mknod-based device node creation/removal under /dev/mapper, since
  devtmpfs nodes are not auto-created without udev.

Also add the devicemapper crate dependency (default-features = false).

But note that the commit depends on device mapper with no-udev support
with the PR:stratis-storage/devicemapper-rs#1036

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
@mulkieran mulkieran moved this from In Progress to In Review in 2026June Jun 15, 2026
@mulkieran mulkieran merged commit 078e70c into stratis-storage:master Jun 15, 2026
12 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in 2026June Jun 15, 2026
@mulkieran mulkieran moved this from Done to Done(2) in 2026June Jun 15, 2026
Apokleos added a commit to kata-containers/kata-containers that referenced this pull request Jun 16, 2026
The kata guest VM runs without udev, so device-mapper nodes under
/dev/mapper are never created automatically. Add the foundational
helpers that subsequent dm-verity integration will rely on:

It focus on the following key points:
(1) DmOptions builders that disable all udev synchronization flags,
  with read-only and deferred-remove variants.
(2) mknod-based device node creation/removal under /dev/mapper, since
  devtmpfs nodes are not auto-created without udev.

Also add the devicemapper crate dependency (default-features = false).

But note that the commit depends on device mapper with no-udev support
with the PR:stratis-storage/devicemapper-rs#1036

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
Apokleos added a commit to Apokleos/kata-containers that referenced this pull request Jun 16, 2026
The kata guest VM runs without udev, so device-mapper nodes under
/dev/mapper are never created automatically. Add the foundational
helpers that subsequent dm-verity integration will rely on:

It focus on the following key points:
(1) DmOptions builders that disable all udev synchronization flags,
  with read-only and deferred-remove variants.
(2) mknod-based device node creation/removal under /dev/mapper, since
  devtmpfs nodes are not auto-created without udev.

Also add the devicemapper crate dependency (default-features = false).

But note that the commit depends on device mapper with no-udev support
with the PR:stratis-storage/devicemapper-rs#1036

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
Apokleos added a commit to Apokleos/kata-containers that referenced this pull request Jun 16, 2026
The kata guest VM runs without udev, so device-mapper nodes under
/dev/mapper are never created automatically. Add the foundational
helpers that subsequent dm-verity integration will rely on:

It focus on the following key points:
(1) DmOptions builders that disable all udev synchronization flags,
  with read-only and deferred-remove variants.
(2) mknod-based device node creation/removal under /dev/mapper, since
  devtmpfs nodes are not auto-created without udev.

Also add the devicemapper crate dependency (default-features = false).

But note that the commit depends on device mapper with no-udev support
with the PR:stratis-storage/devicemapper-rs#1036

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
Apokleos added a commit to Apokleos/kata-containers that referenced this pull request Jun 16, 2026
The kata guest VM runs without udev, so device-mapper nodes under
/dev/mapper are never created automatically. Add the foundational
helpers that subsequent dm-verity integration will rely on:

It focus on the following key points:
(1) DmOptions builders that disable all udev synchronization flags,
  with read-only and deferred-remove variants.
(2) mknod-based device node creation/removal under /dev/mapper, since
  devtmpfs nodes are not auto-created without udev.

Also add the devicemapper crate dependency (default-features = false).

But note that the commit depends on device mapper with no-udev support
with the PR:stratis-storage/devicemapper-rs#1036

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
Apokleos added a commit to Apokleos/kata-containers that referenced this pull request Jun 17, 2026
The kata guest VM runs without udev, so device-mapper nodes under
/dev/mapper are never created automatically. Add the foundational
helpers that subsequent dm-verity integration will rely on:

It focus on the following key points:
(1) DmOptions builders that disable all udev synchronization flags,
  with read-only and deferred-remove variants.
(2) mknod-based device node creation/removal under /dev/mapper, since
  devtmpfs nodes are not auto-created without udev.

Also add the devicemapper crate dependency (default-features = false).

But note that the commit depends on device mapper with no-udev support
with the PR:stratis-storage/devicemapper-rs#1036

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
Apokleos added a commit to kata-containers/kata-containers that referenced this pull request Jun 23, 2026
The kata guest VM runs without udev, so device-mapper nodes under
/dev/mapper are never created automatically. Add the foundational
helpers that subsequent dm-verity integration will rely on:

It focus on the following key points:
(1) DmOptions builders that disable all udev synchronization flags,
  with read-only and deferred-remove variants.
(2) mknod-based device node creation/removal under /dev/mapper, since
  devtmpfs nodes are not auto-created without udev.

Also add the devicemapper crate dependency (default-features = false).

But note that the commit depends on device mapper with no-udev support
with the PR:stratis-storage/devicemapper-rs#1036

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
Apokleos added a commit to Apokleos/kata-containers that referenced this pull request Jun 23, 2026
The kata guest VM runs without udev, so device-mapper nodes under
/dev/mapper are never created automatically. Add the foundational
helpers that subsequent dm-verity integration will rely on:

It focus on the following key points:
(1) DmOptions builders that disable all udev synchronization flags,
  with read-only and deferred-remove variants.
(2) mknod-based device node creation/removal under /dev/mapper, since
  devtmpfs nodes are not auto-created without udev.

Also add the devicemapper crate dependency (default-features = false).

But note that the commit depends on device mapper with no-udev support
with the PR:stratis-storage/devicemapper-rs#1036

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done(2)

Development

Successfully merging this pull request may close these issues.

3 participants