Re: [BUG] btrfs: MAX_LOCKDEP_CHAIN_HLOCKS too low!

From: Mirsad Goran Todorovac
Date: Tue Jun 27 2023 - 14:17:31 EST


On 6/27/23 18:27, Mirsad Goran Todorovac wrote:
Hi, Qu, David,

On 6/27/23 16:27, David Sterba wrote:
On Tue, Jun 27, 2023 at 08:19:37AM +0800, Qu Wenruo wrote:

On 2023/6/27 07:40, Mirsad Goran Todorovac wrote:
Hi,

There is a bug apparently in btrfs file system.

The platform is an assembled box with Ryzen 9 processor and ASRock X670E PG
Lightning motherboard.

I do not have a reproducer, just kernel log:

Jun 26 20:41:58 defiant kernel: [ 2273.786736] BUG:
MAX_LOCKDEP_CHAIN_HLOCKS too low!

This is really what it said.

The setting is too low for certain workload.

In fact Fedora is already increasing this value.
If you want lockdep, I guess that's the only way to go.

https://btrfs.readthedocs.io/en/latest/dev/Development-notes.html#bug-max-lockdep-chain-hlocks-too-low

As the reports will probably keep coming until lockdep changes I'll move
the answer to a more user-visible page.

Thank you for your prompt response. It wasn't obvious from the kernel
message though which .config setting needs adjustment.

I am yet unable to tell whether the lockdep setting being too low and
turning off the locking correctness validator caused the kernel crash, but
I will know more after restarting the kselftest with the new lockdep
setting ...

P.S.

I heard it is uncool to answer one's own email, but I have been unable to
reproduce the crash of yesterday without or with pcscd smartcard daemon
in debug mode.

This of course doesn't mean that the LOCKDEP setting was a direct cause
of crash, I believe that findings are inconclusive. (IMHO, correct locking
should work even with locking correctness validator turned off.)

FYI, here are the crash logs, in case it could help improve btrfs:

[1] https://domac.alu.unizg.hr/~mtodorov/linux/crashes/2023-06-27/

Best regards,
Mirsad Todorovac