Skip to content

Commit

Permalink
Btrfs: fix unprotected extent map operation when logging file extents
Browse files Browse the repository at this point in the history
We forget to protect the modified_extents list, fix it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
  • Loading branch information
Miao Xie authored and Josef Bacik committed Dec 12, 2012
1 parent 315a985 commit bbe1426
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/btrfs/tree-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -3526,8 +3526,10 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
struct extent_map_tree *tree = &BTRFS_I(inode)->extent_tree;
struct extent_map *em, *n;

write_lock(&tree->lock);
list_for_each_entry_safe(em, n, &tree->modified_extents, list)
list_del_init(&em->list);
write_unlock(&tree->lock);
}

if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) {
Expand Down

0 comments on commit bbe1426

Please sign in to comment.