All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 2/2] btrfs: qgroup: add sysfs interface for debug
Date: Wed, 1 Jul 2020 08:06:46 +0800	[thread overview]
Message-ID: <a7cbc3a4-6a6c-8b43-0eb9-4da088be4e58@suse.com> (raw)
In-Reply-To: <20200630165756.GB27795@twin.jikos.cz>



On 2020/7/1 上午12:57, David Sterba wrote:
> On Sun, Jun 28, 2020 at 01:07:15PM +0800, Qu Wenruo wrote:
>> @@ -1030,6 +1040,11 @@ int btrfs_quota_enable(struct btrfs_fs_info *fs_info)
>>  				btrfs_abort_transaction(trans, ret);
>>  				goto out_free_path;
>>  			}
>> +			ret = btrfs_sysfs_add_one_qgroup(fs_info, qgroup);
>> +			if (ret < 0) {
>> +				btrfs_abort_transaction(trans, ret);
>> +				goto out_free_path;
>> +			}
>>  		}
>>  		ret = btrfs_next_item(tree_root, path);
>>  		if (ret < 0) {
>> @@ -1054,6 +1069,11 @@ int btrfs_quota_enable(struct btrfs_fs_info *fs_info)
>>  		btrfs_abort_transaction(trans, ret);
>>  		goto out_free_path;
>>  	}
>> +	ret = btrfs_sysfs_add_one_qgroup(fs_info, qgroup);
>> +	if (ret < 0) {
>> +		btrfs_abort_transaction(trans, ret);
>> +		goto out_free_path;
>> +	}
> 
> This adds 2 new transaction abort sites altough I don't think it's
> justified, the filesystem is fine. If system is that low on memory it's
> gonna be very bad elsewhere too so we don't need to make things worse
> jsut because of some missing sysfs entries.

The problem here is, we don't have good enough way to revert back to
previous status.

This is common among a lot of qgroup code, and I prefer to fix them
later, as it will be a big qgroup error patch cleanup.

> 
> A warning would be better, though in that case the validity of the
> kobjects should be double checked where it's accessed.
> 
It would be even worse if the qgroup relationship is also exported
through sysfs.

In that case, warning is not good enough.

So I still prefer error path cleanup as the ultimate fix.
The objective is, if we hit any error during qgroup enabling or other
qgroup operations, we revert to previous status if possible.

For qgroup enable, if we hit any non-critical error, we don't abort
trans at all, but remove all qgroups along with its qgroup items, remove
the qgroup tree, then reverts back to qgroup disabled case.
This includes -ENOMEM case.

While for critical error like tree operations errors, we still abort
transaction.

In fact, I'm already working on a similar project, but for extent_changeset.
So I guess it won't take too long for qgroup.

Thanks,
Qu


  reply	other threads:[~2020-07-01  0:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-28  5:07 [PATCH v2 0/2] btrfs: add sysfs interface for qgroup Qu Wenruo
2020-06-28  5:07 ` [PATCH v2 1/2] btrfs: use __u16 for the return value of btrfs_qgroup_level() Qu Wenruo
2020-06-28  5:07 ` [PATCH v2 2/2] btrfs: qgroup: add sysfs interface for debug Qu Wenruo
2020-06-29 21:30   ` David Sterba
2020-06-29 23:17     ` Qu Wenruo
2020-06-30  8:07       ` David Sterba
2020-06-30 14:27         ` David Sterba
2020-06-30 16:57   ` David Sterba
2020-07-01  0:06     ` Qu Wenruo [this message]
2020-07-15 13:49   ` Chris Down
2020-07-16  0:15     ` Qu Wenruo
2020-07-16  0:25       ` Chris Down
2020-07-16  0:27       ` Qu Wenruo
     [not found]         ` <20200716004031.GC2140@chrisdown.name>
2020-07-16  1:51           ` Qu Wenruo
2020-07-16  6:21           ` Qu Wenruo
2020-07-16  8:41             ` Chris Down

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=a7cbc3a4-6a6c-8b43-0eb9-4da088be4e58@suse.com \
    --to=wqu@suse.com \
    --cc=dsterba@suse.cz \
    --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 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.