jffs2: -ENOSPC when truncating file?!
joern at logfs.org
Sun Feb 24 06:08:58 EST 2008
On Sun, 24 February 2008 18:57:32 +0800, David Woodhouse wrote:
> On Sun, 2008-02-24 at 07:57 +0100, Jörn Engel wrote:
> > Could a naïve implementation of this get exploited by doing a large
> > number of truncates that just shave single bytes off various files?
> Yeah, which is why _my_ naïve implementation would do it for
> truncate-to-zero instead of just _any_ truncate (which could even be
Truncate-to-larger is trivial to check. Almost every filesystem does it
somewhere, including JFFS2. ;)
But yeah, truncate-to-zero should catch the common case.
> If allowing only truncate-to-zero isn't good enough, perhaps we could
> allow truncation to use the ALLOC_DELETION pool when it's going to
> obsolete at least one full data node. That's not so hard to check.
I would simply always write out a "full" replacement node, i.e. the
complete tail page for the file. No need to check if an old node gets
obsoleted, we just made sure it does. Anyway, it is your baby, so you
get to change the dirty diapers and pick your favorite pair of clean
Joern's library part 3:
More information about the linux-mtd