mtd/fs/jffs2 fs.c,1.8,1.9 readinode.c,1.71,1.72
David Woodhouse
dwmw2 at infradead.org
Fri May 10 12:36:14 EDT 2002
Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv26904
Modified Files:
fs.c readinode.c
Log Message:
Fix deadlock on error cases that call jffs2_do_clear_inode
Index: fs.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/fs.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- fs.c 28 Apr 2002 13:43:03 -0000 1.8
+++ fs.c 10 May 2002 16:36:11 -0000 1.9
@@ -274,9 +274,9 @@
if (jffs2_read_dnode(c, f->metadata, (char *)&rdev, 0, sizeof(rdev)) < 0) {
/* Eep */
printk(KERN_NOTICE "Read device numbers for inode %lu failed\n", (unsigned long)inode->i_ino);
+ up(&f->sem);
jffs2_do_clear_inode(c, f);
make_bad_inode(inode);
- up(&f->sem);
return;
}
Index: readinode.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/readinode.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- readinode.c 6 Mar 2002 12:25:59 -0000 1.71
+++ readinode.c 10 May 2002 16:36:11 -0000 1.72
@@ -337,6 +337,7 @@
printk(KERN_NOTICE "MTD read in jffs2_do_read_inode() failed: Returned %d, %ld of %d bytes read\n",
ret, (long)retlen, sizeof(*latest_node));
/* FIXME: If this fails, there seems to be a memory leak. Find it. */
+ up(&f->sem);
jffs2_do_clear_inode(c, f);
return ret?ret:-EIO;
}
@@ -344,6 +345,7 @@
crc = crc32(0, latest_node, sizeof(*latest_node)-8);
if (crc != latest_node->node_crc) {
printk(KERN_NOTICE "CRC failed for read_inode of inode %u at physical location 0x%x\n", ino, fn->raw->flash_offset & ~3);
+ up(&f->sem);
jffs2_do_clear_inode(c, f);
return -EIO;
}
@@ -378,11 +380,13 @@
kept as the metadata node */
if (f->metadata) {
printk(KERN_WARNING "Argh. Special inode #%u with mode 0%o had metadata node\n", ino, latest_node->mode);
+ up(&f->sem);
jffs2_do_clear_inode(c, f);
return -EIO;
}
if (!f->fraglist) {
printk(KERN_WARNING "Argh. Special inode #%u with mode 0%o has no fragments\n", ino, latest_node->mode);
+ up(&f->sem);
jffs2_do_clear_inode(c, f);
return -EIO;
}
@@ -390,6 +394,7 @@
if (f->fraglist->next) {
printk(KERN_WARNING "Argh. Special inode #%u with mode 0%o had more than one node\n", ino, latest_node->mode);
/* FIXME: Deal with it - check crc32, check for duplicate node, check times and discard the older one */
+ up(&f->sem);
jffs2_do_clear_inode(c, f);
return -EIO;
}
More information about the linux-mtd-cvs
mailing list