Skip to content

crypto: Set libdevmapper logging in crypto plugin too - #1215

Open
vojtechtrefny wants to merge 1 commit into
storaged-project:masterfrom
vojtechtrefny:master_crypto-libdevmapper-logging
Open

vojtechtrefny wants to merge 1 commit into
storaged-project:masterfrom
vojtechtrefny:master_crypto-libdevmapper-logging

Conversation

@vojtechtrefny

@vojtechtrefny vojtechtrefny commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

The plugin doesn't use libdevmapper directly, but libcryptsetup uses it and with recent changes around logging and threads in libdevmapper, it is possible that libcryptsetup will fail to set up logging on their site (libdevmapper allows logging set up only from the main thread and in udisks all libcryptsetup calls run from separate threads) so we want to make sure that someone sets logging. We prefix all log messages so this shouldn't cause any confusion.

Summary by CodeRabbit

  • Bug Fixes
    • Improved device-mapper support detection when crypto support is enabled, helping ensure the required components are available.
    • Device-mapper logging is now configured consistently during crypto initialization and reset when crypto support closes.

The plugin doesn't use libdevmapper directly, but libcryptsetup
uses it and with recent changes around logging and threads in
libdevmapper, it is possible that libcryptsetup will fail to set
up logging on their site (libdevmapper allows logging set up only
from the main thread and in udisks all libcryptsetup calls run
from separate threads) so we want to make sure that someone sets
logging. We prefix all log messages so this shouldn't cause any
confusion.
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: storaged-project/libblockdev/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f427d468-6b8e-42b2-90ac-8244feabd73e
📥 Commits

Reviewing files that changed from the base of the PR and between 3c5433a and 70e47aa.

📒 Files selected for processing: 3
  • configure.ac
  • src/plugins/Makefile.am
  • src/plugins/crypto.c

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

📝 Walkthrough

The crypto plugin now checks for and links device-mapper when crypto support is enabled. It includes device-mapper logging sources, initializes logging at debug- or info-level verbosity, and unregisters the logger and resets verbosity when the plugin closes.

Changes: Crypto Device-Mapper Logging

Layer / File(s) Summary
Device-mapper build support
configure.ac, src/plugins/Makefile.am
The device-mapper dependency check now includes crypto support. Both crypto build branches add device-mapper flags, and the crypto source list includes the device-mapper logging files.
Crypto logging lifecycle
src/plugins/crypto.c
bd_crypto_init initializes device-mapper logging and sets verbosity to LOG_DEBUG in debug builds or LOG_INFO otherwise. bd_crypto_close unregisters the errno-aware logger and resets verbosity to 0.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 70e47

The change is mergeable. A standalone caller that closes crypto while continuing to use DM may see device-mapper messages go to stderr instead of the configured logger.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: configuring libdevmapper logging in the crypto plugin.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (2 skipped: 2 …
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches: 💡 1
🧪 Generate unit tests (beta)
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@tbzatek tbzatek 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.

Very nice!

This branch has not been deployed

No deployments
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.

2 participants