[Ocfs2-devel] [PATCH 1/1] OCFS2: add spin lock when accessing inode->i_nlink.

wangang wang wen.gang.wang at oracle.com
Mon Sep 22 02:15:01 PDT 2008


add spin lock when accessing inode->i_nlink in ocfs2_drop_inode().

the patch is against 1.2 svn.

Signed-off-by: Wengang wang <wen.gang.wang at oracle.com>
--
Index: fs/ocfs2/inode.c
===================================================================
--- fs/ocfs2/inode.c	(revision 3101)
+++ fs/ocfs2/inode.c	(working copy)
@@ -991,10 +991,12 @@
 	/* Testing ip_orphaned_slot here wouldn't work because we may
 	 * not have gotten a delete_inode vote from any other nodes
 	 * yet. */
+	spin_lock(&oi->ip_lock);
 	if (oi->ip_flags & OCFS2_INODE_MAYBE_ORPHANED) {
 		mlog(0, "Inode was orphaned on another node, clearing nlink.\n");
 		inode->i_nlink = 0;
 	}
+	spin_unlock(&oi->ip_lock);
 
 	generic_drop_inode(inode);
 



More information about the Ocfs2-devel mailing list