• Chris Mason's avatar
    Btrfs: fix file clone ioctl for bookend extents · ac6889cb
    Chris Mason authored
    The file clone ioctl was incorrectly taking the offset into the
    extent on disk into account when calculating the length of the
    cloned extent.
    
    The length never changes based on the offset into the physical extent.
    
    Test case:
    
    fallocate -l 1g image
    mke2fs image
    bcp image image2
    e2fsck -f image2
    
    (errors on image2)
    
    The math bug ends up wrapping the length of the extent, and things
    go wrong from there.
    Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
    ac6889cb
ioctl.c 32.3 KB