mtd/fs/jffs2 gc.c,1.86,1.87

David Woodhouse dwmw2 at infradead.org
Tue Oct 8 12:49:13 EDT 2002


Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv8937

Modified Files:
	gc.c 
Log Message:
Don't hold alloc_sem while calling iput(). It deadlocks

Index: gc.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/gc.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- gc.c	10 Sep 2002 07:22:30 -0000	1.86
+++ gc.c	8 Oct 2002 16:49:10 -0000	1.87
@@ -183,8 +183,10 @@
 	D1(if (c->nextblock)
 	   printk(KERN_DEBUG "Nextblock at  %08x, used_size %08x, dirty_size %08x, wasted_size %08x, free_size %08x\n", c->nextblock->offset, c->nextblock->used_size, c->nextblock->dirty_size, c->nextblock->wasted_size, c->nextblock->free_size));
 
-	if (!jeb->used_size)
+	if (!jeb->used_size) {
+		up(&c->alloc_sem);
 		goto eraseit;
+	}
 
 	raw = jeb->gc_node;
 			
@@ -221,8 +223,8 @@
 	if (is_bad_inode(inode)) {
 		printk(KERN_NOTICE "Eep. read_inode() failed for ino #%u\n", inum);
 		/* NB. This will happen again. We need to do something appropriate here. */
-		iput(inode);
 		up(&c->alloc_sem);
+		iput(inode);
 		return -EIO;
 	}
 
@@ -305,6 +307,8 @@
 	iput(inode);
 
  eraseit_lock:
+	up(&c->alloc_sem);
+
 	/* If we've finished this block, start it erasing */
 	spin_lock_bh(&c->erase_completion_lock);
 
@@ -318,7 +322,6 @@
 		jffs2_erase_pending_trigger(c);
 	}
 	spin_unlock_bh(&c->erase_completion_lock);
-	up(&c->alloc_sem);
 
 	return ret;
 }





More information about the linux-mtd-cvs mailing list