From: David Woodhouse <dwmw2@infradead.org>
To: Martin Creutziger <martin.creutziger@barco.com>
Cc: Damir Shayhutdinov <lost404@gmail.com>,
linux-mtd <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH] [JFFS2] Fix free space leaking
Date: Wed, 23 Apr 2008 00:16:50 +0100 [thread overview]
Message-ID: <1208906210.9212.696.camel@pmac.infradead.org> (raw)
In-Reply-To: <1207213384.6161.4.camel@KARCLT0275>
On Thu, 2008-04-03 at 11:03 +0200, Martin Creutziger wrote:
> On Thu, 2008-02-21 at 20:39 +0900, an unknown sender wrote:
> > On Thu, 2008-02-21 at 12:11 +0100, J?rn Engel wrote:
> > > No idea, but it might help to add dwmw2 to Cc:.
> >
> > dwmw2 moderately confused by it. I don't see why it's correct to account
> > for the space as 'free' when it isn't really. If it's causing a
> > persistent leak, shouldn't we deal with that when the block is erased
> > instead?
>
> Hi,
>
> I am currently testing the patch on 2.6.24.2 (as a result of
> http://lists.infradead.org/pipermail/linux-mtd/2008-March/021024.html),
> and so far it seems to at least cure the symptoms, as in: The partition
> does not "fill up" any more so far.
> But: For later production use I would certainly prefer a patch that also
> dwmw2 agrees being a cure to the _cause_, not just the symptoms.
> Any suggestions?
I have reproduced this locally with some extra 'paranoia' debug checks,
and I understand it now. The original patch was doing fairly much the
right thing, but ideally would have looked more like this:
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -459,8 +459,9 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c,
down(&c->erase_free_sem);
spin_lock(&c->erase_completion_lock);
c->erasing_size -= c->sector_size;
- c->free_size += jeb->free_size;
- c->used_size += jeb->used_size;
+ /* We already accounted for the cleanmarker in c->{used,free}_size,
+ so just add the eraseblock size now. */
+ c->free_size += c->sector_size;
jffs2_dbg_acct_sanity_check_nolock(c,jeb);
jffs2_dbg_acct_paranoia_check_nolock(c, jeb);
In fact I've cleaned it up a little more to fix the fact that we were
calling jffs2_link_node_ref() without the required locking:
http://git.infradead.org/mtd-2.6.git?a=commitdiff;h=014b164e1392a166fe96e003d2f0e7ad2e2a0bb7
Thanks for your patience, and for showing me exactly where to look.
--
dwmw2
prev parent reply other threads:[~2008-04-22 23:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-13 10:23 [PATCH] [JFFS2] Fix free space leaking Damir Shayhutdinov
2008-02-06 10:20 ` Joakim Tjernlund
2008-02-06 18:48 ` Damir Shayhutdinov
2008-02-21 11:11 ` Jörn Engel
2008-02-21 11:39 ` David Woodhouse
2008-04-03 9:03 ` Martin Creutziger
2008-04-22 23:16 ` David Woodhouse [this message]
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=1208906210.9212.696.camel@pmac.infradead.org \
--to=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=lost404@gmail.com \
--cc=martin.creutziger@barco.com \
/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