All of lore.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+51244a05705883616c95@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: OCFS2 fix test
Date: Sat, 27 Dec 2025 08:44:42 -0800	[thread overview]
Message-ID: <69500cfa.050a0220.35954c.0091.GAE@google.com> (raw)
In-Reply-To: <66fa0328.050a0220.6bad9.002c.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: OCFS2 fix test
Author: swilczek.lx@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
master

diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index e85b1ccf81be..136aaaae27f3 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -821,6 +821,19 @@ static int ocfs2_acquire_dquot(struct dquot *dquot)
     trace_ocfs2_acquire_dquot(from_kqid(&init_user_ns, dquot->dq_id),
                   type);
     mutex_lock(&dquot->dq_lock);
+    /*
+     * Extend global quota file before acquiring global qf lock to avoid
+     * lock inversion with sb_internal (via ocfs2_start_trans).
+     */
+    if (need_alloc) {
+        WARN_ON(journal_current_handle());
+        status = ocfs2_extend_no_holes(gqinode, NULL,
+            i_size_read(gqinode) + (need_alloc << sb->s_blocksize_bits),
+            i_size_read(gqinode));
+        if (status < 0)
+            goto out;
+    }
+
     /*
      * We need an exclusive lock, because we're going to update use count
      * and instantiate possibly new dquot structure
@@ -843,19 +856,8 @@ static int ocfs2_acquire_dquot(struct dquot *dquot)
     OCFS2_DQUOT(dquot)->dq_use_count++;
     OCFS2_DQUOT(dquot)->dq_origspace = dquot->dq_dqb.dqb_curspace;
     OCFS2_DQUOT(dquot)->dq_originodes = dquot->dq_dqb.dqb_curinodes;
-    if (!dquot->dq_off) {    /* No real quota entry? */
+    if (!dquot->dq_off)    /* No real quota entry? */
         ex = 1;
-        /*
-         * Add blocks to quota file before we start a transaction since
-         * locking allocators ranks above a transaction start
-         */
-        WARN_ON(journal_current_handle());
-        status = ocfs2_extend_no_holes(gqinode, NULL,
-            i_size_read(gqinode) + (need_alloc << sb->s_blocksize_bits),
-            i_size_read(gqinode));
-        if (status < 0)
-            goto out_dq;
-    }

     handle = ocfs2_start_trans(osb,
                    ocfs2_calc_global_qinit_credits(sb, type));

      parent reply	other threads:[~2025-12-27 16:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-30  1:47 [syzbot] [ocfs2?] possible deadlock in ocfs2_acquire_dquot syzbot
2024-10-25  1:08 ` syzbot
2025-12-27 16:44 ` syzbot [this message]

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=69500cfa.050a0220.35954c.0091.GAE@google.com \
    --to=syzbot+51244a05705883616c95@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.