mtd/fs/jffs2 erase.c,1.74,1.75 wbuf.c,1.91,1.92
Artem Bityuckiy
dedekind at infradead.org
Tue Apr 5 08:51:58 EDT 2005
Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv11549
Modified Files:
erase.c wbuf.c
Log Message:
Fix race problems with wbuf.
The patch is accessible at
http://lists.infradead.org/pipermail/linux-mtd/2005-April/012322.html
Index: erase.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/erase.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- erase.c 20 Mar 2005 17:46:20 -0000 1.74
+++ erase.c 5 Apr 2005 12:51:54 -0000 1.75
@@ -333,7 +333,11 @@
bad_offset = ofs;
- ret = jffs2_flash_read(c, ofs, readlen, &retlen, ebuf);
+ if (!jffs2_is_writebuffered(c) || !jffs2_cleanmarker_oob(c))
+ ret = c->mtd->read(c->mtd, ofs, readlen, &retlen, ebuf);
+ else
+ ret = c->mtd->read_ecc(c->mtd, ofs, readlen, &retlen, ebuf, NULL, c->oobinfo);
+
if (ret) {
printk(KERN_WARNING "Read of newly-erased block at 0x%08x failed: %d. Putting on bad_list\n", ofs, ret);
goto bad;
Index: wbuf.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/wbuf.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -r1.91 -r1.92
--- wbuf.c 18 Mar 2005 09:58:06 -0000 1.91
+++ wbuf.c 5 Apr 2005 12:51:54 -0000 1.92
@@ -873,6 +873,7 @@
return c->mtd->read(c->mtd, ofs, len, retlen, buf);
/* Read flash */
+ down_read(&c->wbuf_sem);
if (jffs2_cleanmarker_oob(c))
ret = c->mtd->read_ecc(c->mtd, ofs, len, retlen, buf, NULL, c->oobinfo);
else
@@ -896,16 +897,11 @@
/* if no writebuffer available or write buffer empty, return */
if (!c->wbuf_pagesize || !c->wbuf_len)
- return ret;;
+ goto exit;
/* if we read in a different block, return */
if (SECTOR_ADDR(ofs) != SECTOR_ADDR(c->wbuf_ofs))
- 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);
+ goto exit;
if (ofs >= c->wbuf_ofs) {
owbf = (ofs - c->wbuf_ofs); /* offset in write buffer */
More information about the linux-mtd-cvs
mailing list