Linux EXT4 FS development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Xingyuan Mo" <hdthky0@gmail.com>
Cc: "open list:EXT4 FILE SYSTEM" <linux-ext4@vger.kernel.org>, tytso@mit.edu
Subject: Re: [PATCH] ext4: do not toggle DQUOT_NOLIST_DIRTY with quotas already loaded
Date: Thu, 03 Dec 2026 18:31:14 +0000	[thread overview]
Message-ID: <sashiko-outbox-248394@kernel.org> (raw)
In-Reply-To: <20261203173240.2282734-1-hdthky0@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ext4: ext4_quota_on() latches DQUOT_NOLIST_DIRTY from
  per-type s_qf_names
--

commit 15c30d02158a729a4d149620cdc9f7757e4dce22
Author: Xingyuan Mo <hdthky0@gmail.com>

ext4: do not toggle DQUOT_NOLIST_DIRTY with quotas already loaded

This commit guards updates to the superblock DQUOT_NOLIST_DIRTY flag in
ext4_quota_on() with !sb_any_quota_loaded(sb) so the flag cannot be toggled
while quotas are active.

> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 880f664d6c04b..22438d9f2bb3b 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -7292,13 +7292,12 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
>  			ext4_msg(sb, KERN_WARNING,
>  				"Quota file not on filesystem root. "
>  				"Journaled quota will not work");
> -		sb_dqopt(sb)->flags |= DQUOT_NOLIST_DIRTY;
> -	} else {
> -		/*
> -		 * Clear the flag just in case mount options changed since
> -		 * last time.
> -		 */
> -		sb_dqopt(sb)->flags &= ~DQUOT_NOLIST_DIRTY;
> +	}
> +	if (!sb_any_quota_loaded(sb)) {
> +		if (EXT4_SB(sb)->s_qf_names[type])
> +			sb_dqopt(sb)->flags |= DQUOT_NOLIST_DIRTY;
> +		else
> +			sb_dqopt(sb)->flags &= ~DQUOT_NOLIST_DIRTY;
>  	}

[Severity: Medium]
Should this check ext4_is_quota_journalled(sb) instead of
EXT4_SB(sb)->s_qf_names[type]?

When mounted with only usrjquota=, enabling GRPQUOTA before USRQUOTA clears
DQUOT_NOLIST_DIRTY on the first Q_QUOTAON.  Once USRQUOTA is enabled,
sb_any_quota_loaded(sb) is already true, so DQUOT_NOLIST_DIRTY stays clear
until all quotas are turned off.

ext4_mark_dquot_dirty() checks ext4_is_quota_journalled(sb) and still commits
dquots immediately via ext4_write_dquot().  With DQUOT_NOLIST_DIRTY clear,
each update takes dq_list_lock twice (mark and clear), regressing 91389240a252
("ext4: Disable dirty list tracking of dquots when journalling quotas").

Checking ext4_is_quota_journalled(sb) avoids the enablement-order dependence
and matches ext4_mark_dquot_dirty(), and ext4_check_quota_consistency()
already prevents remount from changing s_qf_names while any quota is loaded.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203173240.2282734-1-hdthky0@gmail.com?part=1

      reply	other threads:[~2026-12-03 18:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 17:33 [PATCH] ext4: do not toggle DQUOT_NOLIST_DIRTY with quotas already loaded Xingyuan Mo
2026-12-03 18:31 ` sashiko-bot [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=sashiko-outbox-248394@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=hdthky0@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tytso@mit.edu \
    /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