All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Subject: [PATCH] btrfs-progs: qgroup: swap the argument in the caller of update_qgroup_relation
Date: Mon, 7 May 2018 16:50:27 +0800	[thread overview]
Message-ID: <20180507085027.23059-1-lufq.fnst@cn.fujitsu.com> (raw)

The QGROUP_RELATION item is very special, it always exists in pairs
(objectid and offset exchange). Its objectid and offset are the ids of a
pair of parent and child qgroups, respectively. The larger one is
parent and the smaller one is child. After the following commit, the order
of the parameters is wrong and causes qgroup show to output the wrong
qgroup parent-child relationship.

Fixes: aaf2dac5ef37 ("btrfs-progs: qgroup: split update_qgroup to reduce arguments")
Issue: #129
Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
 qgroup.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/qgroup.c b/qgroup.c
index 11659e8394dd..e7e127daf5ce 100644
--- a/qgroup.c
+++ b/qgroup.c
@@ -1122,11 +1122,16 @@ static int __qgroups_search(int fd, struct qgroup_lookup *qgroup_lookup)
 				qgroupid = btrfs_search_header_offset(sh);
 				qgroupid1 = btrfs_search_header_objectid(sh);
 
-				if (qgroupid < qgroupid1)
+				if (qgroupid <= qgroupid1)
 					break;
 
+				/*
+				 * because of qgroupid > qgroupid1, qgroupid is
+				 * the id of parent, and qgroupid1 is the id of
+				 * child.
+				 */
 				ret = update_qgroup_relation(qgroup_lookup,
-							qgroupid, qgroupid1);
+							qgroupid1, qgroupid);
 				break;
 			default:
 				return ret;
-- 
2.17.0




             reply	other threads:[~2018-05-07  8:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-07  8:50 Lu Fengqi [this message]
2018-05-07 11:19 ` [PATCH] btrfs-progs: qgroup: swap the argument in the caller of update_qgroup_relation Qu Wenruo
2018-05-08  0:41   ` Lu Fengqi

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=20180507085027.23059-1-lufq.fnst@cn.fujitsu.com \
    --to=lufq.fnst@cn.fujitsu.com \
    --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.