提交 e5846fc6 编写于 作者: C Chris Mason

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: NChris Mason <chris.mason@oracle.com>
上级 dc7fdde3
...@@ -220,10 +220,12 @@ struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root) ...@@ -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) 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)) { if (root->track_dirty && list_empty(&root->dirty_list)) {
list_add(&root->dirty_list, list_add(&root->dirty_list,
&root->fs_info->dirty_cowonly_roots); &root->fs_info->dirty_cowonly_roots);
} }
spin_unlock(&root->fs_info->trans_lock);
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册