• Miao Xie's avatar
    Btrfs: fix preallocate vs double nocow write · 7b2b7085
    Miao Xie authored
    We can not release the reserved metadata space for the first write if we
    find the write position is pre-allocated. Because the kernel might write
    the data on the disk before we do the second write but after the can-nocow
    check, if we release the space for the first write, we might fail to update
    the metadata because of no space.
    
    Fix this problem by end nocow write if there is dirty data in the range whose
    space is pre-allocated.
    Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
    Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
    7b2b7085
inode.c 237 KB