mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Szymon Wilczek <swilczek.lx@gmail.com>
Cc: ocfs2-devel@lists.linux.dev, mark@fasheh.com, jlbec@evilplan.org,
	linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
	syzbot+51244a05705883616c95@syzkaller.appspotmail.com,
	akpm <akpm@linux-foundation.org>
Subject: Re: [PATCH] ocfs2: fix circular locking dependency in ocfs2_acquire_dquot
Date: Tue, 20 Jan 2026 09:37:17 +0800	[thread overview]
Message-ID: <0a2eab22-95ee-4172-9052-aefcbc5bf227@linux.alibaba.com> (raw)
In-Reply-To: <CAJRoVwgxBKXcMSU-CMH8gC1TLnWFdMHiaFGOyFrkDZqzfpN8Ng@mail.gmail.com>



On 1/9/26 10:02 AM, Szymon Wilczek wrote:
> 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
> 

Ummm... When sync and release also is
  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.
> 
From the report link, start_trans is called during
ocfs2_shutdown_local_alloc(), but ocfs2_disable_quotas() is fnished now.
So how it happens?

Thanks,
Joseph

> 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


  reply	other threads:[~2026-01-20  1:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-27 17:42 Szymon Wilczek
2026-01-06  1:37 ` Andrew Morton
2026-01-08  8:43 ` Joseph Qi
2026-01-08 14:15   ` Szymon Wilczek
2026-01-09  1:07     ` Joseph Qi
2026-01-09  2:02       ` Szymon Wilczek
2026-01-20  1:37         ` Joseph Qi [this message]
2026-01-20 23:16           ` Szymon Wilczek
2026-01-08 14:19 ` [PATCH v2] " Szymon Wilczek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0a2eab22-95ee-4172-9052-aefcbc5bf227@linux.alibaba.com \
    --to=joseph.qi@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@lists.linux.dev \
    --cc=swilczek.lx@gmail.com \
    --cc=syzbot+51244a05705883616c95@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®