lkml.org 
[lkml]   [2004]   [May]   [14]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 2.6.6-mm2] vfs iput in inode critical region
FromFabF <>
DateThu, 13 May 2004 21:26:36 +0200
Hi,

	AFAICS, block_dev.c : do_open calls bdput after an unlock_kernel.bdput
calls iput and iput plays with some parameters and locks in iput final
case only.Here's a patch to have a spinlock around the whole iput.

Regards,
FabF 
diff -Naur orig/fs/inode.c edited/fs/inode.c
--- orig/fs/inode.c	2004-05-11 10:13:15.000000000 +0200
+++ edited/fs/inode.c	2004-05-13 21:10:48.000000000 +0200
@@ -1081,16 +1081,20 @@
 void iput(struct inode *inode)
 {
 	if (inode) {
+		spin_lock(&inode_lock);
 		struct super_operations *op = inode->i_sb->s_op;
 
 		if (inode->i_state == I_CLEAR)
 			BUG();
 
+		/*Calling fs relevant put_inode*/
 		if (op && op->put_inode)
 			op->put_inode(inode);
 
-		if (atomic_dec_and_lock(&inode->i_count, &inode_lock))
+		/*finalize if inode is unused*/
+		if (atomic_dec_and_test(&inode->i_count))
 			iput_final(inode);
+		spin_unlock(&inode_lock);
 	}
 }
 
\
 
 \ /
  Last update: 2005-03-22 13:03    [from the cache]
©2003-2008