Bug #96401 No-op mutex_own calls instead of ut_ad(mutex_own)
Submitted: 1 Aug 2019 13:32 Modified: 5 Aug 2019 14:00
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S6 (Debug Builds)
Version:8.0.17 OS:Any
Assigned to: CPU Architecture:Any

[1 Aug 2019 13:32] Laurynas Biveinis
Description:
If one converts mutex_own macro to a function and adds [[nodiscard]] / __attribute__((warn_unused_result)), a few places pop up where an unwrapped mutex_own call sits - i.e. read the mutex status and don't do anything about it. All of them are missing ut_ad wrapper:

clone0snapshot.h:350: Clone_snapshot::in_transit_state:     mutex_own(&m_snapshot_mutex);
buf0buf.cc:987: buf_chunk_init:  mutex_own(&buf_pool->chunks_mutex);

How to repeat:
See above

Suggested fix:
Add missing ut_ad
Convert mutex_own to an inline function with [[nodiscard]]
[5 Aug 2019 14:00] MySQL Verification Team
Hello Mr. Biveinis,

Thank you very much for your bug report.

I agree fully with your analysis.

Verified as reported.