Re: [PATCH] ocfs2: fix circular locking dependency in ocfs2_acquire_dquot
From: Szymon Wilczek
Date: Thu Jan 08 2026 - 21:03:08 EST
Hi Joseph,
Thank you for pointing to the designed order in quota_global.c.
I looked at the locking documentation. I see that
"Acquire dquot for the first time" specifies:
ocfs2_lock_global_qf -> start_trans
However, I believe the v2 patch is still necessary because lockdep
detected a real circular dependency:
sb_internal -> sysfile_lock_key -> ip_alloc_sem
Since ocfs2_lock_global_qf takes ip_alloc_sem, and start_trans takes
sb_internal (via sb_start_intwrite), the documented order inverts the
chain above, creating an ABBA deadlock with freeze/dismount paths.
The designed order may have been correct before sb_start_intwrite
became part of ocfs2_start_trans, but now this sequence conflicts
with the VFS freeze mechanism.
My patch ensures sb_internal is acquired before ip_alloc_sem, which
matches the expected freeze ordering. Perhaps the documentation in
quota_global.c should be updated to reflect this change?
If you see a problem with this approach, I'm happy to adjust.
What would you suggest?
Thanks,
Szymon