From 5a5ed24d7ffa385bd4ee3bcf55920e556f3975a0 Mon Sep 17 00:00:00 2001 From: Estelle Hammache Date: Sat, 5 Feb 2005 18:23:40 +0000 Subject: [PATCH] --- yaml --- r: 4475 b: refs/heads/master c: 67d9e95c393d23c229836e28b262dc73d71da784 h: refs/heads/master i: 4473: 37ff46883c7b257e178c85f4251a8fc1de1fac68 4471: 8dd3392f6d84e4c02ecb964e94c2f0e27fc23335 v: v3 --- [refs] | 2 +- trunk/fs/jffs2/wbuf.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 9232970b1845..732244b9c3f9 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 72b56a2d7dccd9ea90f34f6ddb653086a3f3bd2e +refs/heads/master: 67d9e95c393d23c229836e28b262dc73d71da784 diff --git a/trunk/fs/jffs2/wbuf.c b/trunk/fs/jffs2/wbuf.c index 4346940b4871..79414abadd5e 100644 --- a/trunk/fs/jffs2/wbuf.c +++ b/trunk/fs/jffs2/wbuf.c @@ -9,7 +9,7 @@ * * For licensing information, see the file 'LICENCE' in this directory. * - * $Id: wbuf.c,v 1.85 2005/02/02 22:12:04 dwmw2 Exp $ + * $Id: wbuf.c,v 1.86 2005/02/05 18:23:37 hammache Exp $ * */ @@ -865,7 +865,6 @@ int jffs2_flash_read(struct jffs2_sb_info *c, loff_t ofs, size_t len, size_t *re /* Read flash */ if (!jffs2_can_mark_obsolete(c)) { - down_read(&c->wbuf_sem); if (jffs2_cleanmarker_oob(c)) ret = c->mtd->read_ecc(c->mtd, ofs, len, retlen, buf, NULL, c->oobinfo); @@ -892,11 +891,16 @@ int jffs2_flash_read(struct jffs2_sb_info *c, loff_t ofs, size_t len, size_t *re /* if no writebuffer available or write buffer empty, return */ if (!c->wbuf_pagesize || !c->wbuf_len) - goto exit; + return ret;; /* if we read in a different block, return */ if ( (ofs & ~(c->sector_size-1)) != (c->wbuf_ofs & ~(c->sector_size-1)) ) - goto exit; + return ret; + + /* Lock only if we have reason to believe wbuf contains relevant data, + so that checking an erased block during wbuf recovery space allocation + does not deadlock. */ + down_read(&c->wbuf_sem); if (ofs >= c->wbuf_ofs) { owbf = (ofs - c->wbuf_ofs); /* offset in write buffer */