Re: [PATCH v2 2/2] btrfs: qgroup: add sysfs interface for debug

David Sterba
2020-06-30T16:58:14Z

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.

A warning would be better, though in that case the validity of the
kobjects should be double checked where it's accessed.