public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Artem B. Bityuckiy" <dedekind@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>,
	dwmw2@lists.infradead.org, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATC] small VFS change for JFFS2
Date: Mon, 18 Apr 2005 13:46:56 +0100	[thread overview]
Message-ID: <20050418124656.GA23387@infradead.org> (raw)
In-Reply-To: <1113827466.2125.47.camel@sauron.oktetlabs.ru>

On Mon, Apr 18, 2005 at 04:31:06PM +0400, Artem B. Bityuckiy wrote:
> On Mon, 2005-04-18 at 12:52 +0100, Christoph Hellwig wrote:
> > Oh, I thought the problem is that JFFS2 thought an inode was freed when
> > it still was in use.  So you're problem is actually that it's no in the
> > hash anymore but you don't know yet?
> Yes, exactly. VFS developers may always say "it is your problem -
> redesign JFFS2", but I think it is too late to redesign it.

I don't think it's too late ever ;-)

> > Anyway, please explain in detail why you need all this information, what
> > errors you see, etc so we can find a way to fix it properly.
> Well, I suspect I explained why I need the mutex. If people will find
> the explanation vague, I'll make another attempt.
> 
> The error I see is:
> 
> Eep. Trying to read_inode #15601 when it's already in state 2!
> 
> I debugged this a lot before I've realized the reason. And I believe I
> know JFFS2 very well to claim that redesigning it is very painful. 
> 
> The erroneous  code flow is like this:
> 
> kswapd: removes the inode 15601 from the inode hash (inode.c:478).
> kswapd: is preempted at inode.c:485
> JFFS2 writer: awakes, runs GC to reclaim some space.
> JFFS2 writer: picks a JFFS2 node belonging to the inode 15601
> JFFS2 writer: looks at the inode state, realizes it is in state PRESENT,
> i.e. it is in the inode cache (which is wrong).
> JFFS2 writer: runs iget() to acquire a pointer to the struct inode of
> the inode 15601.
> JFFS2 writer: iget() calls ->read_inode(), i.e., jffs2_read_inode().

Why doesn't __wait_on_freeing_inode get called? prune_icache sets I_FREEING
before it's dropping the inode lock.

Any, this sounds like you'd want to use ilookup because you don't want to
read the inode in the cache anyway, right?

> JFFS2 writed: JFFS2 is surprised why read_inode() is called for the
> already built inode 15601.
> 
> Or may be VFS is buggy, I'm not sure. May be it shouldn't remove inode
> from the inode hash in that point (inode.c:487). It sets the I_FREENG
> state to the inode being freed, and iget() may wait in find_inode_fast()
> while the inode is actually destroyed (inode.c:562). The inode may be
> removed from the inode hash later, in dispose_list() (inode.c:292).
> 
> Or may be this isn't a bug but a feature to make the inode_lock less
> contended. Not sure, I'm not a VFS guru.

Yes, it's a feature.

  parent reply	other threads:[~2005-04-18 12:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-18  8:47 [PATC] small VFS change for JFFS2 Artem B. Bityuckiy
2005-04-18  8:51 ` Christoph Hellwig
2005-04-18  8:58   ` Artem B. Bityuckiy
2005-04-18 10:53     ` Christoph Hellwig
2005-04-18 11:46       ` Artem B. Bityuckiy
2005-04-18 11:52         ` Christoph Hellwig
2005-04-18 12:31           ` Artem B. Bityuckiy
2005-04-18 12:46             ` David Woodhouse
2005-04-18 12:46             ` Christoph Hellwig [this message]
2005-04-18 12:56               ` Artem B. Bityuckiy
2005-04-18 13:08               ` David Woodhouse
2005-04-18 13:38                 ` ntfs ->iput use - was: " Anton Altaparmakov
2005-04-18 13:16               ` David Woodhouse
2005-04-18 14:07                 ` Artem B. Bityuckiy

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=20050418124656.GA23387@infradead.org \
    --to=hch@infradead.org \
    --cc=dedekind@infradead.org \
    --cc=dwmw2@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /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