All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Btrfs: qgroup: part-3: bug fixes for deleting subvolume.
@ 2015-02-10 10:24 Dongsheng Yang
  2015-02-10 10:24 ` [PATCH 1/3] btrfs: qgroup: return EINVAL if level of parent is not higher than child's Dongsheng Yang
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Dongsheng Yang @ 2015-02-10 10:24 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Dongsheng Yang

Hi all,
	This is a part3 for qgroup, it is based on
	Btrfs: qgroup: part-2: bug fixes.

Dongsheng Yang (3):
  btrfs: qgroup: return EINVAL if level of parent is not higher than
    child's.
  btrfs: qgroup: allow to remove qgroup which has parent but no child.
  btrfs: qgroup: fix a wrong parameter of no_quota.

 fs/btrfs/extent-tree.c |  8 ++++++--
 fs/btrfs/qgroup.c      | 35 ++++++++++++++++++++++++++++++-----
 2 files changed, 36 insertions(+), 7 deletions(-)

-- 
1.8.4.2


^ permalink raw reply	[flat|nested] 24+ messages in thread
* [PATCH 1/3] btrfs: qgroup: return EINVAL if level of parent is not higher than child's.
@ 2015-01-22  5:46 Dongsheng Yang
  0 siblings, 0 replies; 24+ messages in thread
From: Dongsheng Yang @ 2015-01-22  5:46 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Dongsheng Yang

When we create a qgroup inheriting a qgroup, we need to check the level
of them. Otherwise, there is a chance where a qgroup can inherit another qgroup
at the same level.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
 fs/btrfs/qgroup.c | 6 ++++++
 fs/btrfs/qgroup.h | 9 +++++++++
 2 files changed, 15 insertions(+)

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 953befd..c2983a4 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -2221,6 +2221,12 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans,
 				ret = -EINVAL;
 				goto out;
 			}
+
+			if ((srcgroup->qgroupid >> BTRFS_QGROUP_LEVEL_SHIFT) <=
+			    (objectid >> BTRFS_QGROUP_LEVEL_SHIFT)) {
+				ret = -EINVAL;
+				goto out;
+			}
 			++i_qgroups;
 		}
 	}
diff --git a/fs/btrfs/qgroup.h b/fs/btrfs/qgroup.h
index 18cc68c..67291ff 100644
--- a/fs/btrfs/qgroup.h
+++ b/fs/btrfs/qgroup.h
@@ -20,6 +20,15 @@
 #define __BTRFS_QGROUP__
 
 /*
+ * The ID of a qgroup consists of a level and a id, looks like: 1/3.
+ * The 1 is the level means this qgroup is in the level 1 and the 3
+ * is the id of this qgroup in level 1. We use a u64 number store a
+ * qgroup ID, the first 16bits stands for the level and the last 48bits
+ * stands for the id.
+ */
+#define BTRFS_QGROUP_LEVEL_SHIFT	48
+
+/*
  * A description of the operations, all of these operations only happen when we
  * are adding the 1st reference for that subvolume in the case of adding space
  * or on the last reference delete in the case of subtraction.  The only
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2015-03-17 15:27 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-10 10:24 [PATCH 0/3] Btrfs: qgroup: part-3: bug fixes for deleting subvolume Dongsheng Yang
2015-02-10 10:24 ` [PATCH 1/3] btrfs: qgroup: return EINVAL if level of parent is not higher than child's Dongsheng Yang
2015-02-10 10:24 ` [PATCH 2/3] btrfs: qgroup: allow to remove qgroup which has parent but no child Dongsheng Yang
2015-02-10 10:24 ` [PATCH 3/3] btrfs: qgroup: fix a wrong parameter of no_quota Dongsheng Yang
2015-02-10 11:24   ` Filipe David Manana
2015-02-11  2:51     ` Dongsheng Yang
2015-02-13  9:38   ` Dongsheng Yang
2015-02-26  6:05     ` Dongsheng Yang
2015-03-03 11:13       ` [PATCH] fstest: btrfs: add a test for quota number when deleting a subvol Dongsheng Yang
2015-03-03 11:13         ` Dongsheng Yang
2015-03-06  5:06         ` Eryu Guan
2015-03-16  5:06           ` Dongsheng Yang
2015-03-16  5:06             ` Dongsheng Yang
2015-03-16  5:33             ` Eryu Guan
2015-03-16  5:47               ` Dongsheng Yang
2015-03-16  5:47                 ` Dongsheng Yang
2015-03-16  5:58             ` [PATCH v2] " Dongsheng Yang
2015-03-16  5:58               ` Dongsheng Yang
2015-03-03 11:18       ` [PATCH 3/3] btrfs: qgroup: fix a wrong parameter of no_quota Dongsheng Yang
2015-03-03 14:00         ` Josef Bacik
2015-03-03 20:20           ` Mark Fasheh
2015-03-16  4:59             ` Dongsheng Yang
2015-03-17 15:27               ` Dongsheng Yang
  -- strict thread matches above, loose matches on Subject: below --
2015-01-22  5:46 [PATCH 1/3] btrfs: qgroup: return EINVAL if level of parent is not higher than child's Dongsheng Yang

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.