diff options
| author | Chris Mason <chris.mason@oracle.com> | 2012-05-03 12:08:48 -0400 |
|---|---|---|
| committer | Chris Mason <chris.mason@oracle.com> | 2012-05-04 15:14:11 -0400 |
| commit | e5846fc665d1c3dd32d877febe7402ccd583b8a1 (patch) | |
| tree | 162d4487dd5cb573036507821d92d5c0c559d56b | |
| parent | dc7fdde39e4962b1a88741f7eba2a6b3be1285d8 (diff) | |
Btrfs: Add properly locking around add_root_to_dirty_list
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>
| -rw-r--r-- | fs/btrfs/ctree.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index e801f226d7e0..086303b9be64 100644 --- 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) | |||
| 220 | */ | 220 | */ |
| 221 | static void add_root_to_dirty_list(struct btrfs_root *root) | 221 | static void add_root_to_dirty_list(struct btrfs_root *root) |
| 222 | { | 222 | { |
| 223 | spin_lock(&root->fs_info->trans_lock); | ||
| 223 | if (root->track_dirty && list_empty(&root->dirty_list)) { | 224 | if (root->track_dirty && list_empty(&root->dirty_list)) { |
| 224 | list_add(&root->dirty_list, | 225 | list_add(&root->dirty_list, |
| 225 | &root->fs_info->dirty_cowonly_roots); | 226 | &root->fs_info->dirty_cowonly_roots); |
| 226 | } | 227 | } |
| 228 | spin_unlock(&root->fs_info->trans_lock); | ||
| 227 | } | 229 | } |
| 228 | 230 | ||
| 229 | /* | 231 | /* |
