[Ocfs2-commits] mfasheh commits r1616 - branches/dlm-glue/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Nov 1 20:53:36 CST 2004


Author: mfasheh
Date: 2004-11-01 20:53:33 -0600 (Mon, 01 Nov 2004)
New Revision: 1616

Modified:
   branches/dlm-glue/src/inode.c
Log:
* cluster voting and cluster locking are seperate now so recheck some
  inode flags which are set during a delete vote in delete_inode.



Modified: branches/dlm-glue/src/inode.c
===================================================================
--- branches/dlm-glue/src/inode.c	2004-11-02 02:20:02 UTC (rev 1615)
+++ branches/dlm-glue/src/inode.c	2004-11-02 02:53:33 UTC (rev 1616)
@@ -604,18 +604,20 @@
 		goto bail;
 	}
 
+	spin_lock(&OCFS_I(inode)->ip_lock);
 	if (OCFS_I(inode)->ip_flags & OCFS_INODE_SKIP_DELETE) {
+		spin_unlock(&OCFS_I(inode)->ip_lock);
 		LOG_TRACE_ARGS("Skipping delete of %lu because another node "
 			       "has done this for us.\n", inode->i_ino);
 		goto bail;
 	}
+	spin_unlock(&OCFS_I(inode)->ip_lock);
 
 	/* If we're coming from process_vote we can't go into our own
 	 * voting [hello, deadlock city!], so unforuntately we just
 	 * have to skip deleting this guy. That's OK though because
 	 * the node who's doing the actual deleting should handle it
 	 * anyway. */
-
 	if (current == osb->vote_task) {
 		LOG_TRACE_ARGS("Skipping delete of %lu because we're currently"
 			       "in process_vote\n", inode->i_ino);
@@ -627,12 +629,24 @@
 	 * delete_inode. */
 	atomic_inc(&inode->i_count);
 	status = ocfs2_meta_lock(inode, NULL, &fe_bh, 1);
-	atomic_set(&inode->i_count, 0);
+	atomic_dec(&inode->i_count);
 	if (status < 0) {
 		LOG_ERROR_STATUS(status);
 		goto bail;
 	}
 
+	/* While we were waiting for the lock, another node might have
+	 * asked to delete the inode. Recheck our flags to catch this
+	 * race and just clear_inode instead.*/
+	spin_lock(&OCFS_I(inode)->ip_lock);
+	if (OCFS_I(inode)->ip_flags & OCFS_INODE_SKIP_DELETE) {
+		spin_unlock(&OCFS_I(inode)->ip_lock);
+		LOG_TRACE_ARGS("Skipping delete of %lu because another node "
+			       "has done this for us.\n", inode->i_ino);
+		goto bail;
+	}
+	spin_unlock(&OCFS_I(inode)->ip_lock);
+
 	status = ocfs2_request_delete_vote(inode);
 	if (status < 0) {
 		/* EBUSY here is assumed to mean that other nodes are



More information about the Ocfs2-commits mailing list