• Miao Xie's avatar
    Btrfs: fix wrong i_size when truncating a file to a larger size · f4a2f4c5
    Miao Xie authored
    Btrfsck report error 100 after the 83th case of xfstests was run, it means
    the i_size of the file is wrong.
    
    The reason of this bug is that:
    Btrfs increased i_size of the file at the beginning, but it failed to expand
    the file, and failed to update the i_size to the old size because there is no
    enough space in the file system, so we found a wrong i_size.
    
    This patch fixes this bug by updating the i_size just when we pass the file
    expanding and get enough space to update i-node.
    Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
    Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
    f4a2f4c5
inode.c 194 KB