Created attachment 19194 [details] Proposed fix When running smbstatus (or other CLI tools) on platforms without POSIX robust mutex support (e.g., OpenBSD), the standard error output is polluted with multiple "mutexes requested but not available" error messages on debug level 0 (DBG_ERR). This behavior was introduced in commit 89b16e8a0f89af2336bdaa18d39eb3eb25d5ae77 ("s3: Warn if no mutexes available at runtime"). In dbwrap_open.c and tdb_wrap.c, try_mutex defaults to true for TDB databases. When tdb_runtime_check_for_robust_mutexes() evaluates to false, Samba logs a high-priority DBG_ERR before falling back to POSIX fcntl file locking. try_mutex is a best-effort check. Falling back to POSIX file locking when an optional OS capability is missing is expected operational flow, not an unrecoverable error (DBG_ERR). Hard mutex requirements are already explicitly handled by dbwrap_tdb_require_mutexes. As a result, out-of-the-box installations on non-robust-mutex OSs emit error messages during normal operation. Actual Result: CLI tools output multiple mutexes requested but not available lines to stderr on level 0. Expected Result: Samba silently falls back to fcntl locking when try_mutex fails. If logging is desired, it should use DBG_INFO (level 2) or DBG_NOTICE (level 1) so standard CLI output on level 0 remains clean. Proposed Fix: Revert commit 89b16e8a0f89af2336bdaa18d39eb3eb25d5ae77 to restore clean silent fallback for try_mutex.
I'd gate the messages on #ifdef HAVE_ROBUST_MUTEXES
(In reply to Stefan Metzmacher from comment #1) Makes sense. Guarding the DBG_ERR log calls with #ifdef HAVE_ROBUST_MUTEXES fixes the CLI noise on OpenBSD (and other non-robust-mutex platforms) while preserving the runtime warning on platforms where robust mutex support was compiled in. New patch attached.
Created attachment 19196 [details] gate on HAVE_ROBUST_MUTEXES
Fix looks good to me. Samba has some formalism to go through gitlab with a git commit message etc. Do you want to do that yourself or do you want us to take care of that?
(In reply to Volker Lendecke from comment #4) If you don't mind taking care of GitLab / commit message, that would be greatly appreciated.
(In reply to Bjorn Ketelaars from comment #5) > If you don't mind taking care of GitLab / commit message, that would be > greatly appreciated. Ah, I forgot: We need a DCO according to https://www.samba.org/samba/devel/copyright-policy.html or a confirmation that you are doing the work as a private hobby or so.
(In reply to Volker Lendecke from comment #6) I am a hobbyist contributor, so if I have understood the DCO correctly, it might not apply here. I have gone ahead and reviewed the contribution wiki and opened up a pull request. Hope this is helpful! https://gitlab.com/samba-team/samba/-/merge_requests/4700
This bug was referenced in samba master: 3a79fa00ffd9c7f3b0ef10ba458cf16f2c4ab8ec 4d45e61a158143194efb91974ab667ba341b0536