mtd/fs/jffs2 README.Locking,1.9,1.10

Artem Bityuckiy dedekind at infradead.org
Wed Nov 24 03:30:03 EST 2004


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

Modified Files:
	README.Locking 
Log Message:
Update the locking documentation.


Index: README.Locking
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/README.Locking,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- README.Locking	20 Nov 2004 10:35:40 -0000	1.9
+++ README.Locking	24 Nov 2004 08:30:00 -0000	1.10
@@ -112,27 +112,32 @@
 will not be removed. So, it is allowed to access it without locking
 the inocache_lock spinlock. 
 
-Ordering constraints: 
-
-	If both erase_completion_lock and inocache_lock are needed, the
-	c->erase_completion has to be acquired first.
-
 
 	erase_free_sem
 	--------------
 
-This semaphore is only used by the erase code which frees obsolete
+This semaphore is used by the erase code which frees obsolete
 node references and the jffs2_garbage_collect_deletion_dirent()
 function. The latter function on NAND flash must read _obsolete_ nodes
 to determine whether the 'deletion dirent' under consideration can be
 discarded or whether it is still required to show that an inode has
 been unlinked. Because reading from the flash may sleep, the
-erase_completion_lock cannot be held, so an alternative, more
+erase_completion_lock can not be held, so an alternative, more
 heavyweight lock was required to prevent the erase code from freeing
 the jffs2_raw_node_ref structures in question while the garbage
 collection code is looking at them.
 
-Suggestions for alternative solutions to this problem would be welcomed.
+The erase_free_sem mutex is also used in the jffs2_mark_node_obsolete()
+function which manipulates obsolete nodes (which may be removed
+from the list and freed any time) and may sleep (since it reads flash).
+
+Ordering constraints: 
+
+	c->erase_completion_lock, c->erase_free_sem and c->inocache_lock
+	has special ordering:
+	1. c->erase_free_sem (must be locked first);
+	2. c->erase_completion_lock
+	3. c->inocache_lock
 
 
 	wbuf_sem





More information about the linux-mtd-cvs mailing list