From 74a0508739bc41746b8c9f2c92f4ead6c66c4bd0 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sun, 20 May 2012 15:43:53 +0200 Subject: [PATCH] --- yaml --- r: 309921 b: refs/heads/master c: 20b297d620cd1bb94127942bbb3702fb7b1030b2 h: refs/heads/master i: 309919: 56a42e734e2553b70eb3f732914a55b21cc46ab6 v: v3 --- [refs] | 2 +- trunk/fs/btrfs/transaction.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 75904de5ce65..b7c1a95fae68 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 19ae4e8133f370d820c4cdd61a4b703235664a5f +refs/heads/master: 20b297d620cd1bb94127942bbb3702fb7b1030b2 diff --git a/trunk/fs/btrfs/transaction.c b/trunk/fs/btrfs/transaction.c index eb2bd826bb04..667735fb45e6 100644 --- a/trunk/fs/btrfs/transaction.c +++ b/trunk/fs/btrfs/transaction.c @@ -122,6 +122,24 @@ static noinline int join_transaction(struct btrfs_root *root, int nofail) cur_trans->delayed_refs.flushing = 0; cur_trans->delayed_refs.run_delayed_start = 0; cur_trans->delayed_refs.seq = 1; + + /* + * although the tree mod log is per file system and not per transaction, + * the log must never go across transaction boundaries. + */ + smp_mb(); + if (!list_empty(&fs_info->tree_mod_seq_list)) { + printk(KERN_ERR "btrfs: tree_mod_seq_list not empty when " + "creating a fresh transaction\n"); + WARN_ON(1); + } + if (!RB_EMPTY_ROOT(&fs_info->tree_mod_log)) { + printk(KERN_ERR "btrfs: tree_mod_log rb tree not empty when " + "creating a fresh transaction\n"); + WARN_ON(1); + } + atomic_set(&fs_info->tree_mod_seq, 0); + init_waitqueue_head(&cur_trans->delayed_refs.seq_wait); spin_lock_init(&cur_trans->commit_lock); spin_lock_init(&cur_trans->delayed_refs.lock);