All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Schmidt <list.btrfs@jan-o-sch.net>
To: chris.mason@fusionio.com, linux-btrfs@vger.kernel.org
Cc: sensille@gmx.net
Subject: [PATCH v1 05/15] Btrfs: check the root passed to btrfs_end_transaction
Date: Thu, 12 Jul 2012 11:43:37 +0200	[thread overview]
Message-ID: <d13603ef6e14a12cd65a6975e8117c0fea7c7ddf.1342083345.git.list.btrfs@jan-o-sch.net> (raw)
In-Reply-To: <cover.1342083345.git.list.btrfs@jan-o-sch.net>
In-Reply-To: <cover.1342083345.git.list.btrfs@jan-o-sch.net>

From: Arne Jansen <sensille@gmx.net>

This patch only add a consistancy check to validate that the
same root is passed to start_transaction and end_transaction.
Subvolume quota depends on this.

Signed-off-by: Arne Jansen <sensille@gmx.net>
---
 fs/btrfs/transaction.c |    6 ++++++
 fs/btrfs/transaction.h |    6 ++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 621c8dc..23cbda0 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -345,6 +345,7 @@ again:
 	h->transaction = cur_trans;
 	h->blocks_used = 0;
 	h->bytes_reserved = 0;
+	h->root = root;
 	h->delayed_ref_updates = 0;
 	h->use_count = 1;
 	h->block_rsv = NULL;
@@ -511,6 +512,11 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
 
 	btrfs_trans_release_metadata(trans, root);
 	trans->block_rsv = NULL;
+	/*
+	 * the same root has to be passed to start_transaction and
+	 * end_transaction. Subvolume quota depends on this.
+	 */
+	WARN_ON(trans->root != root);
 	while (count < 2) {
 		unsigned long cur = trans->delayed_ref_updates;
 		trans->delayed_ref_updates = 0;
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
index fe27379..0107294 100644
--- a/fs/btrfs/transaction.h
+++ b/fs/btrfs/transaction.h
@@ -57,6 +57,12 @@ struct btrfs_trans_handle {
 	struct btrfs_block_rsv *block_rsv;
 	struct btrfs_block_rsv *orig_rsv;
 	int aborted;
+	/*
+	 * this root is only needed to validate that the root passed to
+	 * start_transaction is the same as the one passed to end_transaction.
+	 * Subvolume quota depends on this
+	 */
+	struct btrfs_root *root;
 };
 
 struct btrfs_pending_snapshot {
-- 
1.7.3.4


  parent reply	other threads:[~2012-07-12  9:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-12  9:43 [PATCH v1 00/15] Btrfs: subvolume quota groups (qgroups) Jan Schmidt
2012-07-12  9:43 ` [PATCH v1 01/15] Btrfs: fix buffer leak in btrfs_next_old_leaf Jan Schmidt
2012-07-12  9:43 ` [PATCH v1 02/15] Btrfs: join tree mod log code with the code holding back delayed refs Jan Schmidt
2012-07-12  9:43 ` [PATCH v1 03/15] Btrfs: qgroup on-disk format Jan Schmidt
2012-07-12  9:43 ` [PATCH v1 04/15] Btrfs: add helper for tree enumeration Jan Schmidt
2012-07-12 11:38   ` Alexander Block
2012-07-12  9:43 ` Jan Schmidt [this message]
2012-07-12  9:43 ` [PATCH v1 06/15] Btrfs: added helper to create new trees Jan Schmidt
2012-07-12  9:43 ` [PATCH v1 07/15] Btrfs: qgroup state and initialization Jan Schmidt
2012-07-12  9:43 ` [PATCH v1 08/15] Btrfs: Test code to change the order of delayed-ref processing Jan Schmidt
2012-07-12  9:43 ` [PATCH v1 09/15] Btrfs: qgroup implementation and prototypes Jan Schmidt
2012-07-12  9:43 ` [PATCH v1 10/15] Btrfs: call the qgroup accounting functions Jan Schmidt
2012-07-12  9:43 ` [PATCH v1 11/15] Btrfs: quota tree support and startup Jan Schmidt
2012-07-12  9:43 ` [PATCH v1 12/15] Btrfs: hooks for qgroup to record delayed refs Jan Schmidt
2012-07-12  9:43 ` [PATCH v1 13/15] Btrfs: hooks to reserve qgroup space Jan Schmidt
2012-07-12  9:43 ` [PATCH v1 14/15] Btrfs: add qgroup ioctls Jan Schmidt
2012-07-12  9:43 ` [PATCH v1 15/15] Btrfs: add qgroup inheritance Jan Schmidt
2012-07-17 18:33 ` [PATCH v1 00/15] Btrfs: subvolume quota groups (qgroups) Alex Lyakas
2012-07-17 19:25   ` Arne Jansen
2012-07-17 20:46     ` Jan Schmidt
2012-07-18  7:50     ` Alex Lyakas

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=d13603ef6e14a12cd65a6975e8117c0fea7c7ddf.1342083345.git.list.btrfs@jan-o-sch.net \
    --to=list.btrfs@jan-o-sch.net \
    --cc=chris.mason@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sensille@gmx.net \
    /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.