• Chris Mason's avatar
    Btrfs: Fix extent replacment race · a1ed835e
    Chris Mason authored
    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: default avatarChris Mason <chris.mason@oracle.com>
    a1ed835e
extent_map.h 1.64 KB