Re: [PATCH] ocfs2: fix circular locking dependency in ocfs2_acquire_dquot
From: Szymon Wilczek
Date: Tue Jan 20 2026 - 18:16:56 EST
Hi Joseph,
You are absolutely correct. Since ocfs2_disable_quotas() completes before
ocfs2_shutdown_local_alloc(), these two specific paths likely cannot race
at runtime.
However, the Lockdep report is based on lock classes, not just runtime
concurrency.
1. The shutdown path (ocfs2_shutdown_local_alloc) teaches Lockdep:
sb_internal -> ocfs2_sysfile_lock_key (on Local Alloc inode)
2. The acquire path (ocfs2_acquire_dquot) teaches Lockdep:
ocfs2_sysfile_lock_key (on Quota inode) -> sb_internal
Because both inodes use the same lock class (ocfs2_sysfile_lock_key),
Lockdep sees a contradiction:
sb_internal -> sysfile -> sb_internal
Even if they don't race, this inconsistent ordering is a violation
that Lockdep flags. Fixing the order in acquire_dquot resolves this
contradiction and ensures sb_internal (freeze protection) is always
taken outermost.
Thanks,
Szymon