On Mon, Jul 09, 2007 at 05:38:26PM +1000, David Chinner wrote:
>
> When we change the file size via xfs_setattr(), we log the
> new, in-memory file size in the transaction. We do this without
> having flushed any dirty data so if we have previously extended
> the file we change the on disk file size without having written
> the data first.
>
> This is a problem for both growing the file and truncating the
> file. The truncate case is partially hidden by the VTRUNCATE
> code, but if the file has not been closed before a crash has
> occurred we can still get NULLs appearing in files.
>
> The following patch fixes this problem by flushing the range
> between the on-disk filesize and the new file size as long
> as the new file size is larger than the on disk file size.
>
> Comments?
Looks good.
> + (ip->i_size != ip->i_d.di_size) &&
> + (vap->va_size > ip->i_d.di_size)) {
And if I'd really want to get picky I'd say please remove all the superflous
braces here..
|