• Dave Chinner's avatar
    xfs: clear XFS_IDIRTY_RELEASE on truncate down · df4368a1
    Dave Chinner authored
    When an inode is truncated down, speculative preallocation is
    removed from the inode. This should also reset the state bits for
    controlling whether preallocation is subsequently removed when the
    file is next closed. The flag is not being cleared, so repeated
    operations on a file that first involve a truncate (e.g. multiple
    repeated dd invocations on a file) give different file layouts for
    the second and subsequent invocations.
    
    Fix this by clearing the XFS_IDIRTY_RELEASE state bit when the
    XFS_ITRUNCATED bit is detected in xfs_release() and hence ensure
    that speculative delalloc is removed on files that have been
    truncated down.
    Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
    df4368a1
xfs_vnodeops.c 70 KB