projects
/
platform
/
kernel
/
linux-arm64.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dc7fdde
)
Btrfs: Add properly locking around add_root_to_dirty_list
author
Chris Mason
<chris.mason@oracle.com>
Thu, 3 May 2012 16:08:48 +0000
(12:08 -0400)
committer
Chris Mason
<chris.mason@oracle.com>
Fri, 4 May 2012 19:14:11 +0000
(15:14 -0400)
add_root_to_dirty_list happens once at the very beginning of the
transaction, but it is still racey.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ctree.c
patch
|
blob
|
history
diff --git
a/fs/btrfs/ctree.c
b/fs/btrfs/ctree.c
index
e801f22
..
086303b
100644
(file)
--- a/
fs/btrfs/ctree.c
+++ b/
fs/btrfs/ctree.c
@@
-220,10
+220,12
@@
struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root)
*/
static void add_root_to_dirty_list(struct btrfs_root *root)
{
+ spin_lock(&root->fs_info->trans_lock);
if (root->track_dirty && list_empty(&root->dirty_list)) {
list_add(&root->dirty_list,
&root->fs_info->dirty_cowonly_roots);
}
+ spin_unlock(&root->fs_info->trans_lock);
}
/*