]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: Fix extent replacment race
authorChris Mason <chris.mason@oracle.com>
Fri, 11 Sep 2009 16:27:37 +0000 (12:27 -0400)
committerChris Mason <chris.mason@oracle.com>
Fri, 11 Sep 2009 17:31:07 +0000 (13:31 -0400)
commit6fe5deb7405e239e8bee3fc011f50a51efa48f73
treeac3b370823fa76c5be7698e3663306badbbd622d
parentc84ba5b09724455ab720ce14724efa0b9f0f02f4
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>
fs/btrfs/ctree.h
fs/btrfs/extent_map.c
fs/btrfs/extent_map.h
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/tree-log.c