Re: truncate() can fail

Bill Hawes (whawes@star.net)
Wed, 03 Dec 1997 09:16:31 -0500


Hans-Joachim Widmaier wrote:
>
> While testing the new affs code, I stumbled upon a
> deficiency in the VFS: truncate() is not allowed to
> fail. This might be a fair assumption for ext2 (but
> even that needs inderection blocks), but certainly
> is wrong with affs: If truncate is used to enlarge
> a file, it can well happen that the disk gets full.
> inode->i_size will happily reflect the new and
> wrong size.
>
> If I'm not totally wrong here, I'd like to change
> the VFS and filesystems so that truncate() can
> return an error, too.

I've seen comments in other filesystems complaining about the lack of a
return code, so it seems like a good idea to me. Of course, probably no
software applications are checking for errors, but it would be better to
allow for the future possibility.

Regards,
Bill