From: sashiko-bot@kernel.org
To: "Ye Bin" <yebin@huaweicloud.com>, linux-ext4@vger.kernel.org
Cc: tytso@mit.edu
Subject: Re: [PATCH] ext4: protect ext4_acquire_dquot against freezing
Date: Mon, 23 Nov 2026 12:02:25 +0000 [thread overview]
Message-ID: <sashiko-outbox-229179@kernel.org> (raw)
In-Reply-To: <20261123114602.66520-1-yebin@huaweicloud.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] ext4: deadlock with thaw_super() in ext4_acquire_dquot() via
Q_XGETQUOTA
--
commit f23e3eb68e6a88d3c8dec26c7efee607385b6388
Author: Ye Bin <yebin10@huawei.com>
ext4: protect ext4_acquire_dquot against freezing
This commit wraps ext4_acquire_dquot() with sb_start_intwrite() and
sb_end_intwrite() when no journal transaction is currently active to
protect quota acquisition against filesystem freezing.
Link: https://patchwork.kernel.org/project/linux-fsdevel/patch/20261112135245.3347102-1-yebin@huaweicloud.com/
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 359f9d4ed4479..a06d5f298c849 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -7118,11 +7118,25 @@ static int ext4_acquire_dquot(struct dquot *dquot)
> {
> int ret, err;
> handle_t *handle;
> + bool freeze_protected = false;
> +
> + /*
> + * Trying to sb_start_intwrite() in a running transaction
> + * can result in a deadlock. Further, running transactions
> + * are already protected from freezing.
> + */
> + if (!ext4_journal_current_handle()) {
> + sb_start_intwrite(dquot->dq_sb);
> + freeze_protected = true;
> + }
[Severity: High]
Can calling sb_start_intwrite() here cause an ABBA deadlock between
sb->s_umount and SB_FREEZE_FS when Q_XGETQUOTA or Q_XGETNEXTQUOTA runs on
a frozen filesystem?
quotactl_cmd_write() returns 0 for Q_XGETQUOTA and Q_XGETNEXTQUOTA, so
quotactl_block() and quotactl_fd() acquire down_read(&sb->s_umount)
without waiting for the filesystem to thaw. If the queried dquot is not
yet active in memory, dquot_get_dqblk() calls dqget() ->
ext4_acquire_dquot() with no running transaction and blocks in
sb_start_intwrite() while holding s_umount:
CPU0 CPU1
---- ----
down_read(&sb->s_umount)
sb_freeze_unlock(sb, SB_FREEZE_FS)
sb_start_intwrite(sb)
down_write(&sb->s_umount)
*** DEADLOCK ***
CPU0: do_quotactl() -> quota_getxquota() -> dquot_get_dqblk() ->
dqget() -> ext4_acquire_dquot()
CPU1: thaw_super() -> super_lock_excl() -> thaw_super_locked()
Once this happens, thaw_super() cannot acquire s_umount to unfreeze the
filesystem, leaving the filesystem permanently wedged.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123114602.66520-1-yebin@huaweicloud.com?part=1
next prev parent reply other threads:[~2026-11-23 12:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 11:46 [PATCH] ext4: protect ext4_acquire_dquot against freezing Ye Bin
2026-11-23 12:02 ` sashiko-bot [this message]
2026-11-24 3:55 ` yebin (H)
2026-11-24 17:14 ` Jan Kara
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-229179@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tytso@mit.edu \
--cc=yebin@huaweicloud.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.