Skip to content

Conversation

@vojtechtrefny
Copy link
Member

@vojtechtrefny vojtechtrefny commented Dec 16, 2025

This error code is used when the LUKS2 device requires some features not supported by the used version of cryptsetup, e.g. when trying to open a device created with a newer version. The "Text file busy" error message return by strerror is not very usefull in this case.

Fixes: #1148

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling for LUKS device activation with better diagnostic messages when unsupported LUKS2 requirements are detected during device activation attempts.

✏️ Tip: You can customize this high-level summary in your review settings.

This error code is used when the LUKS2 device requires some
features not supported by the used version of cryptsetup, e.g.
when trying to open a device created with a newer version. The
"Text file busy" error message return by strerror is not very
usefull in this case.

Fixes: storaged-project#1148
@coderabbitai
Copy link

coderabbitai bot commented Dec 16, 2025

Walkthrough

Added error handling in the crypto device activation function to detect and report the ETXTBSY return value with a descriptive message about unsupported LUKS2 requirements, replacing the generic "Text file busy" error from the system.

Changes

Cohort / File(s) Change Summary
LUKS2 error messaging
src/plugins/crypto.c
Added conditional branch in bd_crypto_luks_open_flags to handle -ETXTBSY error with specific message "Failed to activate device: Unknown or unsupported LUKS2 requirements detected."

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Single function modification with a straightforward error condition check
  • Adds one new conditional branch following an existing error handling pattern
  • No changes to logic, API surface, or existing error paths
  • Clear mapping of system error code to user-facing message

Pre-merge checks and finishing touches

✅ 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 describes the main change: improved error handling for ETXTBSY return value from crypt_activate.
Linked Issues check ✅ Passed The code change directly addresses issue #1148 by detecting ETXTBSY and providing a more informative error message about unsupported LUKS2 features.
Out of Scope Changes check ✅ Passed All changes are scoped to the error handling path for crypt_activate in bd_crypto_luks_open_flags, directly related to the stated objective.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6983fd2 and 32b0822.

📒 Files selected for processing (1)
  • src/plugins/crypto.c (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (42)
  • GitHub Check: testing-farm:fedora-43-aarch64
  • GitHub Check: testing-farm:fedora-43-x86_64
  • GitHub Check: testing-farm:fedora-43-x86_64
  • GitHub Check: testing-farm:fedora-43-aarch64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:fedora-43-aarch64
  • GitHub Check: rpm-build:fedora-rawhide-ppc64le
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-43-aarch64
  • GitHub Check: rpm-build:fedora-rawhide-aarch64
  • GitHub Check: rpm-build:fedora-43-ppc64le
  • GitHub Check: rpm-build:fedora-rawhide-ppc64le
  • GitHub Check: rpm-build:fedora-rawhide-aarch64
  • GitHub Check: rpm-build:fedora-43-ppc64le
  • GitHub Check: testing-farm:fedora-43-x86_64:revdeps_udisks
  • GitHub Check: testing-farm:fedora-43-x86_64:revdeps_blivet
  • GitHub Check: testing-farm:fedora-43-x86_64
  • GitHub Check: testing-farm:fedora-43-aarch64
  • GitHub Check: rpm-build:fedora-43-aarch64
  • GitHub Check: rpm-build:fedora-rawhide-aarch64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-43-ppc64le
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-ppc64le
  • GitHub Check: symbols
  • GitHub Check: csmock
  • GitHub Check: compilation (gcc-10)
  • GitHub Check: compilation (gcc-11)
  • GitHub Check: compilation (clang-17)
  • GitHub Check: compilation (clang-14)
  • GitHub Check: compilation (clang-18)
  • GitHub Check: compilation (clang-16)
  • GitHub Check: compilation (clang-15)
  • GitHub Check: compilation (gcc-13)
  • GitHub Check: compilation (gcc-12)
  • GitHub Check: compilation (gcc-14)
  • GitHub Check: blivet-tests
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (cpp)
  • GitHub Check: udisks-build
🔇 Additional comments (1)
src/plugins/crypto.c (1)

1361-1363: LGTM! Excellent improvement to error messaging.

The new error handling for ETXTBSY correctly identifies when a LUKS2 device requires cryptsetup features not available in the current version. The descriptive error message "Unknown or unsupported LUKS2 requirements detected" is vastly more helpful than the generic "Text file busy" message from strerror(). The implementation follows the established error handling pattern and is correctly positioned between the specific -EPERM check and the generic error case.


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.

@vojtechtrefny vojtechtrefny merged commit 1d15c5a into storaged-project:master Dec 17, 2025
41 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show better error when crypt_activate returns ETXTBSY

2 participants