summaryrefslogtreecommitdiff
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2008-08-04 23:23:47 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:06 -0400
commitb48652c101cce7a54379a49cc0cf854cec2c94e2 (patch)
tree13e8250b326b71fed80811e1ed3b19b00beded31 /fs/btrfs/transaction.c
parent3de9d6b649b4cc60687be92e71cef36d7d4e8f2f (diff)
downloadlwn-b48652c101cce7a54379a49cc0cf854cec2c94e2.tar.gz
lwn-b48652c101cce7a54379a49cc0cf854cec2c94e2.zip
Btrfs: Various small fixes.
This trivial patch contains two locking fixes and a off by one fix. --- Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index a2c821e3c3a7..ebf5362da1d2 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -389,9 +389,7 @@ int btrfs_commit_tree_roots(struct btrfs_trans_handle *trans,
return 0;
}
-int btrfs_add_dead_root(struct btrfs_root *root,
- struct btrfs_root *latest,
- struct list_head *dead_list)
+int btrfs_add_dead_root(struct btrfs_root *root, struct btrfs_root *latest)
{
struct btrfs_dirty_root *dirty;
@@ -400,7 +398,10 @@ int btrfs_add_dead_root(struct btrfs_root *root,
return -ENOMEM;
dirty->root = root;
dirty->latest_root = latest;
- list_add(&dirty->list, dead_list);
+
+ mutex_lock(&root->fs_info->trans_mutex);
+ list_add(&dirty->list, &latest->fs_info->dead_roots);
+ mutex_unlock(&root->fs_info->trans_mutex);
return 0;
}