diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2007-03-21 05:07:05 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2007-04-17 13:53:51 -0400 |
commit | b0afbbec4981417f79e05865a36e57abfc289002 (patch) | |
tree | b0e14a643310de8e1232859f5b4af3effe3a7ea6 /fs/jffs2/erase.c | |
parent | 4226b510371efd9cdc628663527d36aee36054a9 (diff) |
[JFFS2] fix deadlock on error path
When the MTD driver returns write failure, the following deadlock
occurs:
We are in __jffs2_flush_wbuf(), we hold &c->wbuf_sem. Write failure.
jffs2_wbuf_recover()->jffs2_reserve_space_gc()->jffs2_do_reserve_space()
->jffs2_erase_pending_blocks()->jffs2_flash_read()
and it tries to lock &c->wbuf_sem again. Deadlock.
Reported-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/erase.c')
-rw-r--r-- | fs/jffs2/erase.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c index ad0121088dd..6b1f7bee365 100644 --- a/fs/jffs2/erase.c +++ b/fs/jffs2/erase.c | |||
@@ -333,7 +333,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl | |||
333 | 333 | ||
334 | *bad_offset = ofs; | 334 | *bad_offset = ofs; |
335 | 335 | ||
336 | ret = jffs2_flash_read(c, ofs, readlen, &retlen, ebuf); | 336 | ret = c->mtd->read(c->mtd, ofs, readlen, &retlen, ebuf); |
337 | if (ret) { | 337 | if (ret) { |
338 | printk(KERN_WARNING "Read of newly-erased block at 0x%08x failed: %d. Putting on bad_list\n", ofs, ret); | 338 | printk(KERN_WARNING "Read of newly-erased block at 0x%08x failed: %d. Putting on bad_list\n", ofs, ret); |
339 | goto fail; | 339 | goto fail; |