Subject: Re: problems in a full ffs file system
To: Peter Jordan <p.jordan@teles.de>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: tech-kern
Date: 02/16/2007 09:15:20
On Fri, Feb 16, 2007 at 02:40:24PM +0100, Peter Jordan wrote:
> Sorry, 
> 
> I forgot to explain this more in detail, 
> 
> If I fill a file with much a characters and then I see something others at
> the end of teh file:
> 
> aaaaaaaaaaaaaaaaaaaaaaa
> aaaaaaaaaaaaaaaaaaaaaaa
> aaaaaaaaaaaaaaaaaaaaaaa
> aaaaaaaaaaaaaaaaaaaaaaa
> aaaaaaaaaaaaaaaaaaaaaaa
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

These are NULL characters: all-zero bytes.

> also occured that I saw at the end of the file the content of the
> bash-history or other stuff, which I did not wrote into the file. It is
> something else.

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.

Thor