From: Qu Wenruo <wqu@suse.com>
To: Boris Burkov <boris@bur.io>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v3 2/2] btrfs: automatically remove the subvolume qgroup
Date: Tue, 21 May 2024 10:35:19 +0930 [thread overview]
Message-ID: <23aa71da-b9a1-414d-aa16-a46512455641@suse.com> (raw)
In-Reply-To: <298e832e-349a-4914-81c3-f276b6cbc290@suse.com>
在 2024/5/21 08:33, Qu Wenruo 写道:
>
>
> 在 2024/5/21 08:20, Boris Burkov 写道:
> [...]
>>> + /*
>>> + * It's squota and the subvolume still has numbers needed
>>> + * for future accounting, in this case we can not delete.
>>> + * Just skip it.
>>> + */
>>
>> Maybe throw in an ASSERT or WARN or whatever you think is best checking
>> for squota mode, if we are sure this shouldn't happen for normal qgroup?
>
> Sounds good.
>
> Would add an ASSERT() for making sure it's squota mode.
After more thought, I believe ASSERT() can lead to false alerts.
The problem here is, we do not have any extra race prevention here,
really rely on one time call on btrfs_remove_qgroup() to do the proper
locking.
But after btrfs_remove_qgroup() returned -EBUSY, we can race with qgroup
disabling, thus doing an ASSERT() without the proper lock context can
lead to false alert, e.g. the qgroup is disabled after
btrfs_remove_qgroup() call.
So I'm afraid we can not do extra checks here.
Thanks,
Qu
>
> Thanks,
> Qu
>
>>
>>> + if (ret == -EBUSY)
>>> + ret = 0;
>>> + return ret;
>>> +}
>>> +
>>> int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid,
>>> struct btrfs_qgroup_limit *limit)
>>> {
>>> diff --git a/fs/btrfs/qgroup.h b/fs/btrfs/qgroup.h
>>> index 706640be0ec2..3f93856a02e1 100644
>>> --- a/fs/btrfs/qgroup.h
>>> +++ b/fs/btrfs/qgroup.h
>>> @@ -327,6 +327,8 @@ int btrfs_del_qgroup_relation(struct
>>> btrfs_trans_handle *trans, u64 src,
>>> u64 dst);
>>> int btrfs_create_qgroup(struct btrfs_trans_handle *trans, u64
>>> qgroupid);
>>> int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, u64
>>> qgroupid);
>>> +int btrfs_qgroup_cleanup_dropped_subvolume(struct btrfs_fs_info
>>> *fs_info,
>>> + u64 subvolid);
>>> int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid,
>>> struct btrfs_qgroup_limit *limit);
>>> int btrfs_read_qgroup_config(struct btrfs_fs_info *fs_info);
>>> --
>>> 2.45.0
>>>
>
prev parent reply other threads:[~2024-05-21 1:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-07 6:58 [PATCH v3 0/2] btrfs: qgroup: stale qgroups related impromvents Qu Wenruo
2024-05-07 6:58 ` [PATCH v3 1/2] btrfs: slightly loose the requirement for qgroup removal Qu Wenruo
2024-05-20 22:46 ` Boris Burkov
2024-05-07 6:58 ` [PATCH v3 2/2] btrfs: automatically remove the subvolume qgroup Qu Wenruo
2024-05-20 22:50 ` Boris Burkov
2024-05-20 23:03 ` Qu Wenruo
2024-05-21 1:05 ` Qu Wenruo [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=23aa71da-b9a1-414d-aa16-a46512455641@suse.com \
--to=wqu@suse.com \
--cc=boris@bur.io \
--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