From: Qu Wenruo <wqu@suse.com>
To: fdmanana@kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/3] btrfs: qgroup: set quota enabled bit if quota disable fails flushing reservations
Date: Wed, 2 Jul 2025 07:45:04 +0930 [thread overview]
Message-ID: <4d56c88c-695b-4fba-9baa-50fa3ec61a6d@suse.com> (raw)
In-Reply-To: <6f75859e2d0736e332a568d0babf05abc4ec46ed.1751383079.git.fdmanana@suse.com>
在 2025/7/2 01:12, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
>
> Before waiting for the rescan worker to finish and flushing reservations,
> we clear the BTRFS_FS_QUOTA_ENABLED flag from fs_info. If we fail flushing
> reservations we leave with the flag not set which is not correct since
> quotas are still enabled - we must set back the flag on error paths, such
> as when we fail to start a transaction, except for error paths that abort
> a transaction. The reservation flushing happens very early before we do
> any operation that actually disables quotas and before we start a
> transaction, so set back BTRFS_FS_QUOTA_ENABLED if it fails.
>
> Fixes: af0e2aab3b70 ("btrfs: qgroup: flush reservations during quota disable")
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
I initially thought it will be a little racy when setting/clearing the
ENABLED flag without qgroup_ioctl_mutex, but since we're already holding
subvol_sem() for both enable and disable, it should be fine.
Thanks,
Qu
> ---
> fs/btrfs/qgroup.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
> index 42d3cfb84318..eb1bb57dee7d 100644
> --- a/fs/btrfs/qgroup.c
> +++ b/fs/btrfs/qgroup.c
> @@ -1334,11 +1334,14 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info)
>
> /*
> * We have nothing held here and no trans handle, just return the error
> - * if there is one.
> + * if there is one and set back the quota enabled bit since we didn't
> + * actually disable quotas.
> */
> ret = flush_reservations(fs_info);
> - if (ret)
> + if (ret) {
> + set_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags);
> return ret;
> + }
>
> /*
> * 1 For the root item
next prev parent reply other threads:[~2025-07-01 22:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-01 15:42 [PATCH 0/3] btrfs: qgroup fixes and a cleanup fdmanana
2025-07-01 15:42 ` [PATCH 1/3] btrfs: qgroup: set quota enabled bit if quota disable fails flushing reservations fdmanana
2025-07-01 22:15 ` Qu Wenruo [this message]
2025-07-01 15:42 ` [PATCH 2/3] btrfs: qgroup: fix qgroup create ioctl returning success after quotas disabled fdmanana
2025-07-01 22:22 ` Qu Wenruo
2025-07-01 15:42 ` [PATCH 3/3] btrfs: qgroup: use btrfs_qgroup_enabled() in ioctls fdmanana
2025-07-01 22:28 ` Qu Wenruo
2025-07-01 16:20 ` [PATCH 0/3] btrfs: qgroup fixes and a cleanup David Sterba
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=4d56c88c-695b-4fba-9baa-50fa3ec61a6d@suse.com \
--to=wqu@suse.com \
--cc=fdmanana@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
/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