Re: [Yaffs] Yaffs deadlock in yaffs_evict_inode()

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Eivind Tagseth
Date:  
To: yaffs
Subject: Re: [Yaffs] Yaffs deadlock in yaffs_evict_inode()
Den 16. sep. 2013 11:13, skrev Eivind Tagseth:
>
> As far as I can see (see backtrace below), the yaffs_bg_thread_fn() runs
> yaffs_bg_gc() with yaffs_gross_lock(). During the gc run, yaffs finds a
> bad block and tells the nand layer to mark it bad. nand_update_bbt()
> then needs to malloc a page for the bbt, is out of free pages, and calls
> try_to_free_pages().
> try_to_free_pages() finds a page owned by yaffs that it wants to free,
> and calls yaffs_evict_node(), which requires the yaffs_gross_lock(), and
> the yaffs fs is now deadlocked!

I guess the easy fix is for the nand layer (nand_update_bbt()) to assume
that it may always be called from within a filesystem and to use
GFP_NOFS rather than GFP_KERNEL in the kmalloc. This way the whole
problem is avoided. I guess this may lead to more out of memory errors,
but that seems to be handled ok by yaffs as far as I can see.



Eivind