Re: [syzbot ci] Re: ocfs2: fix circular locking dependency in ocfs2_init_acl()

Krystian Kaniewski <[email protected]> Tue, 21 Jul 2026 22:47:40 +0200
Newsgroups dev.linux.lists.syzbot
Message-ID <[email protected]>
V4 correctly moves the parent default ACL lookup and ACL derivation 
before allocator reservation and ocfs2_start_trans(). It also fixes the 
v3 ownership problems by zero-initializing the ACL state, clearing 
released pointers, cleaning the state on every preparation error, and 
releasing it on the reflink failure path. Keep those changes, together 
with the current POSIX ACL result semantics, mode and security ordering, 
and exact reservation calculations.

One lock-order problem remains. ocfs2_mknod() starts its transaction and 
then calls ocfs2_init_acl(). When a directory inherits a default ACL, or 
when the derived access ACL must be stored, ocfs2_set_acl() reaches 
ocfs2_xattr_set_handle(). Initial security labels reach the same helper 
through ocfs2_init_security_set(). ocfs2_xattr_set_handle() still takes 
inode->ip_xattr_sem while the create path already holds allocation 
resources, sb_internal, and j_trans_barrier.

The ordinary ocfs2_xattr_set() path establishes the reverse dependency 
by taking ip_xattr_sem before reserving metadata and starting its 
transaction. All ip_xattr_sem instances are initialized at the same call 
site and therefore share one lockdep class. It does not matter to 
lockdep that the create path locks the new inode rather than the parent. 
A create under a parent with a default ACL can still establish the same 
circular class dependency.

The existing reproducer does not prove this path is fixed. It sets 
system.posix_acl_access rather than an inheritable 
system.posix_acl_default, so mkdir can avoid both default and access ACL 
xattr writes after the transaction starts. It also does not necessarily 
force an initial security xattr.

Required corrections:

1. Audit every caller of ocfs2_xattr_set_handle(). Confirm and document 
that this helper is used only while initializing a new inode that has 
not yet been inserted into the inode hash or attached to a dentry.
2. Make creation-time ACL and security xattr writes avoid acquiring the 
normal ip_xattr_sem class after allocator reservation and transaction 
start. A suitable approach is to remove the unnecessary semaphore 
acquisition from the private new-inode helper or split out an explicit 
no-lock creation helper. If serialization is still required, acquire it 
before the allocator resources and transaction, with balanced cleanup on 
every exit.
3. Keep the locking in the ordinary ocfs2_xattr_set() path unchanged. Do 
not suppress a real dependency with a lockdep annotation unless the 
private-inode lifetime argument is explicit and valid for every caller.
4. Preserve the v4 ACL state ownership fixes, __posix_acl_create() 
zero-versus-positive handling, inode owner and security initialization 
order, symlink and no-POSIX-ACL behavior, reflink behavior, and separate 
default/access ACL reservation calculations.
5. Clean up the four expression line breaks in ocfs2_calc_xattr_init() 
that end immediately after an opening parenthesis.

On 7/21/2026 11:33 AM, syzbot ci wrote:
> syzbot ci has tested the following series
>
> [v4] ocfs2: fix circular locking dependency in ocfs2_init_acl()
> https://lore.kernel.org/all/[email protected]
> * [PATCH RFC v4] ocfs2: fix circular locking dependency in ocfs2_init_acl()
>
> and found no issues.
>
> Full report is available here:
> https://ci.syzbot.org/series/78a8c280-1c08-431d-aab1-f2054f103460
>
> ***
>
> If these findings have caused you to resend the series or submit a
> separate fix, please add the following tag to your commit message:
>    Tested-by: [email protected]
>
> ---
> This report is generated by a bot. It may contain errors.
> syzbot ci engineers can be reached at [email protected].