Subject: Re: problems in a full ffs file system
To: Thor Lancelot Simon <tls@rek.tjls.com>
From: Eric Haszlakiewicz <erh@swapsimple.com>
List: tech-kern
Date: 02/16/2007 11:30:02
On Fri, Feb 16, 2007 at 09:15:20AM -0500, Thor Lancelot Simon wrote:
> These are the contents of some other file to which the last block or
> fragment allocated for the file previously belonged.
> 
> So this is a bug, and what the bug is is that on filesystem full, the
> very last block or fragment allocated is not filled with the data that
> the caller of write() wrote, but it is still left allocated to the file.
> 
> Can you tell me if write() returns a byte count indicating that it did
> write that final data, or not?
> 
> Please file a PR (you can paste this email into the PR as well if that
> is helpful).  I've carboned some FFS experts who might have an
> easier time seeing exactly why this happens than I will.

I was able to reproduce this on a 204800 byte filesystem mounted 
through vnd.
It looks like the last portion of the file, even that which already had data
successfully written to it, gets partially filled with 0's.  The file ends up
9180 bytes long, and the 0's start after byte 8192.  There is less than
1k free.
Attempting to append a smaller amount of data (e.g. a single character)
works even after the larger write corrupts the file, but again the end of
the file gets filled with 0's once the filesystem is too full to even allow
that.

eric