Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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>
  • Loading branch information...
commit e5846fc665d1c3dd32d877febe7402ccd583b8a1 1 parent dc7fdde
@chrismason-xx chrismason-xx authored
Showing with 2 additions and 0 deletions.
  1. +2 −0  fs/btrfs/ctree.c
View
2  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);
}
/*
Please sign in to comment.
Something went wrong with that request. Please try again.