JFFS2 gc deadlock

Josh Boyer jdub at us.ibm.com
Tue Nov 8 08:48:58 EST 2005


On Mon, 2005-11-07 at 15:18 -0600, Josh Boyer wrote:
> Ok, around line 1210 of gc.c, this comment is present (formatted for
> better read-ability):
> 
> 	/* First, use readpage() to read the appropriate page into the page cache */
> 	/* Q: What happens if we actually try to GC the _same_ page for which commit_write()
> 	 *    triggered garbage collection in the first place?
> 	 * A: I _think_ it's OK. read_cache_page shouldn't deadlock, we'll write out the
> 	 *    page OK. We'll actually write it out again in commit_write, which is a little
> 	 *    suboptimal, but at least we're correct.
> 	 */
> 
> Can someone explain to me how read_cache_page won't deadlock in that
> case?  From what I can see, it will deadlock quite easily.  Shouldn't
> jffs2_garbage_collect_dnode or an above function check if the page is
> being written to already?

Nevermind, it seems I have some quite old JFFS2 code.  The current CVS
version sets PageUptodate in jffs2_commit_write, which avoids the
deadlock situation.

Thanks for suffering a fool.

josh





More information about the linux-mtd mailing list