From: "Jörn Engel" <joern@logfs.org>
To: David Woodhouse <dwmw2@infradead.org>
Cc: "Jörn Engel" <joern@logfs.org>, "Pavel Machek" <pavel@ucw.cz>,
linux-mtd@lists.infradead.org,
"kernel list" <linux-kernel@vger.kernel.org>
Subject: Re: jffs2: -ENOSPC when truncating file?!
Date: Sun, 24 Feb 2008 12:08:58 +0100 [thread overview]
Message-ID: <20080224110858.GC31293@lazybastard.org> (raw)
In-Reply-To: <1203850653.13749.9.camel@shinybook.infradead.org>
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).
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
ones.
Jörn
--
Joern's library part 3:
http://inst.eecs.berkeley.edu/~cs152/fa05/handouts/clark-test.pdf
next prev parent reply other threads:[~2008-02-24 11:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-23 23:57 Pavel Machek
2008-02-24 0:36 ` David Woodhouse
2008-02-24 6:57 ` Jörn Engel
2008-02-24 10:57 ` David Woodhouse
2008-02-24 11:08 ` Jörn Engel [this message]
2008-02-24 19:02 ` Pavel Machek
2008-02-24 7:24 ` Pavel Machek
2008-02-24 16:11 ` Jamie Lokier
2008-02-25 7:48 ` Alexander Belyakov
2008-03-03 12:15 ` Pavel Machek
2008-03-03 15:10 ` Jörn Engel
2008-03-03 16:09 ` Alexander Belyakov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080224110858.GC31293@lazybastard.org \
--to=joern@logfs.org \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=pavel@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®