From: Arne Jansen <sensille@gmx.net>
To: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Cc: linux-btrfs@vger.kernel.org, miaox@cn.fujitsu.com
Subject: Re: [PATCH 1/3] Btrfs: fix oops when writing dirty qgroups to disk
Date: Fri, 09 Aug 2013 11:30:36 +0200 [thread overview]
Message-ID: <5204B6BC.9010605@gmx.net> (raw)
In-Reply-To: <1375852351-11919-1-git-send-email-wangsl.fnst@cn.fujitsu.com>
On 07.08.2013 07:12, Wang Shilong wrote:
> When disabling quota, we should clear out list 'dirty_qgroups',otherwise,
> we will get oops if enabling quota again. Fix this by abstracting similar
> code from del_qgroup_rb().
>
> Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
> Reviewed-by: Miao Xie <miaox@cn.fujitsu.com>
> ---
> fs/btrfs/qgroup.c | 43 ++++++++++++++-----------------------------
> 1 file changed, 14 insertions(+), 29 deletions(-)
>
> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
> index 64a9e3c..3b103e2 100644
> --- a/fs/btrfs/qgroup.c
> +++ b/fs/btrfs/qgroup.c
> @@ -157,18 +157,11 @@ static struct btrfs_qgroup *add_qgroup_rb(struct btrfs_fs_info *fs_info,
> return qgroup;
> }
>
> -/* must be called with qgroup_lock held */
> -static int del_qgroup_rb(struct btrfs_fs_info *fs_info, u64 qgroupid)
> +static void __del_qgroup_rb(struct btrfs_qgroup *qgroup)
> {
> - struct btrfs_qgroup *qgroup = find_qgroup_rb(fs_info, qgroupid);
> - struct btrfs_qgroup_list *list;
> + struct btrfs_qgroup_list *list = NULL;
Why do you initialize list to NULL here? It's always assigned
before used.
otherwise,
Reviewed-by: Arne Jansen <sensille@gmx.net>
>
> - if (!qgroup)
> - return -ENOENT;
> -
> - rb_erase(&qgroup->node, &fs_info->qgroup_tree);
> list_del(&qgroup->dirty);
> -
> while (!list_empty(&qgroup->groups)) {
> list = list_first_entry(&qgroup->groups,
> struct btrfs_qgroup_list, next_group);
> @@ -185,7 +178,18 @@ static int del_qgroup_rb(struct btrfs_fs_info *fs_info, u64 qgroupid)
> kfree(list);
> }
> kfree(qgroup);
> +}
> +
> +/* must be called with qgroup_lock held */
> +static int del_qgroup_rb(struct btrfs_fs_info *fs_info, u64 qgroupid)
> +{
> + struct btrfs_qgroup *qgroup = find_qgroup_rb(fs_info, qgroupid);
>
> + if (!qgroup)
> + return -ENOENT;
> +
> + rb_erase(&qgroup->node, &fs_info->qgroup_tree);
> + __del_qgroup_rb(qgroup);
> return 0;
> }
>
> @@ -435,30 +439,11 @@ void btrfs_free_qgroup_config(struct btrfs_fs_info *fs_info)
> {
> struct rb_node *n;
> struct btrfs_qgroup *qgroup;
> - struct btrfs_qgroup_list *list;
>
> while ((n = rb_first(&fs_info->qgroup_tree))) {
> qgroup = rb_entry(n, struct btrfs_qgroup, node);
> rb_erase(n, &fs_info->qgroup_tree);
> -
> - while (!list_empty(&qgroup->groups)) {
> - list = list_first_entry(&qgroup->groups,
> - struct btrfs_qgroup_list,
> - next_group);
> - list_del(&list->next_group);
> - list_del(&list->next_member);
> - kfree(list);
> - }
> -
> - while (!list_empty(&qgroup->members)) {
> - list = list_first_entry(&qgroup->members,
> - struct btrfs_qgroup_list,
> - next_member);
> - list_del(&list->next_group);
> - list_del(&list->next_member);
> - kfree(list);
> - }
> - kfree(qgroup);
> + __del_qgroup_rb(qgroup);
> }
> /*
> * we call btrfs_free_qgroup_config() when umounting
prev parent reply other threads:[~2013-08-09 9:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-07 5:12 [PATCH 1/3] Btrfs: fix oops when writing dirty qgroups to disk Wang Shilong
2013-08-07 5:12 ` [PATCH 2/3] Btrfs: move btrfs_free_qgroup_config() out of spin_lock and fix comments Wang Shilong
2013-08-09 9:42 ` Arne Jansen
2013-08-09 9:57 ` Wang Shilong
2013-08-07 5:12 ` [PATCH 3/3] Btrfs: remove reduplicate check when disabling quota Wang Shilong
2013-08-09 9:36 ` Arne Jansen
2013-08-07 5:16 ` [PATCH 1/3] Btrfs: fix oops when writing dirty qgroups to disk Wang Shilong
2013-08-08 13:20 ` Josef Bacik
2013-08-09 9:12 ` Wang Shilong
2013-08-09 9:30 ` Arne Jansen [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=5204B6BC.9010605@gmx.net \
--to=sensille@gmx.net \
--cc=linux-btrfs@vger.kernel.org \
--cc=miaox@cn.fujitsu.com \
--cc=wangsl.fnst@cn.fujitsu.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.