diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-09-11 20:27:37 +0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-09-11 21:31:07 +0400 |
commit | a1ed835e1ab5795f91b198d08c43e2f56848dcf3 (patch) | |
tree | ac3b370823fa76c5be7698e3663306badbbd622d /fs/btrfs/tree-log.c | |
parent | 8b62b72b26bcd72082c4a69d179dd906bcc22200 (diff) | |
download | linux-a1ed835e1ab5795f91b198d08c43e2f56848dcf3.tar.xz |
Btrfs: Fix extent replacment race
Data COW means that whenever we write to a file, we replace any old
extent pointers with new ones. There was a window where a readpage
might find the old extent pointers on disk and cache them in the
extent_map tree in ram in the middle of a given write replacing them.
Even though both the readpage and the write had their respective bytes
in the file locked, the extent readpage inserts may cover more bytes than
it had locked down.
This commit closes the race by keeping the new extent pinned in the extent
map tree until after the on-disk btree is properly setup with the new
extent pointers.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r-- | fs/btrfs/tree-log.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index d91b0de7c502..8661a7381b39 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -534,7 +534,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, saved_nbytes = inode_get_bytes(inode); /* drop any overlapping extents */ ret = btrfs_drop_extents(trans, root, inode, - start, extent_end, extent_end, start, &alloc_hint); + start, extent_end, extent_end, start, &alloc_hint, 1); BUG_ON(ret); if (found_type == BTRFS_FILE_EXTENT_REG || |