[Ocfs2-commits] mfasheh commits r1388 - trunk/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Aug 26 15:31:11 CDT 2004


Author: mfasheh
Date: 2004-08-26 15:31:09 -0500 (Thu, 26 Aug 2004)
New Revision: 1388

Modified:
   trunk/src/journal.c
Log:
* make the commit thread loop back around during shutdown if there's
  still transactions pending -- this can happen as a result of
  delete_inode during a commit_cache operation.



Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c	2004-08-26 18:07:56 UTC (rev 1387)
+++ trunk/src/journal.c	2004-08-26 20:31:09 UTC (rev 1388)
@@ -380,6 +380,8 @@
 	if (!osb || !osb->journal->k_journal)
 		BUG();
 
+	OCFS_ASSERT(osb->journal->state != OCFS_JOURNAL_FREE);
+
 	/* JBD might support this, but our journalling code doesn't yet. */
 	if (journal_current_handle()) {
 		LOG_ERROR_STR("Recursive transaction attempted!");
@@ -1161,6 +1163,8 @@
 		kfree(osb->commit);
 	}
 
+	OCFS_ASSERT(atomic_read(&(osb->journal->num_trans)) == 0);
+
 	/* Shutdown the kernel journal system */
 	journal_destroy(journal->k_journal);
 
@@ -1848,14 +1852,28 @@
 				break;
 		}
 
+skip_sleep:
 		status = ocfs_commit_cache(osb);
 		if (status < 0)
 			LOG_ERROR_STATUS(status);
 
-		/* journal shutdown has asked me to do
-		 * one last commit cache and then exit */
-		if (journal->state == OCFS_JOURNAL_IN_SHUTDOWN)
-			break;
+		/* journal shutdown has asked me to sync up and then
+		 * exit. We might still have transactions pending as
+		 * our last commit might've put deleted inodes on the
+		 * list so we loop back around. */
+		if (journal->state == OCFS_JOURNAL_IN_SHUTDOWN) {
+			/* we can trust num_trans here because we're
+			 * in shutdown and nobody other than ourselves
+			 * should be able to start more. */
+			if (atomic_read(&journal->num_trans) == 0)
+				break;
+#ifdef VERBOSE_COMMIT_THREAD
+			printk("(%u) commit_thread: %u transactions pending "
+			       "on shutdown\n",
+			       current->pid, atomic_read(&journal->num_trans));
+#endif
+			goto skip_sleep;
+		}
 	}
 
 	complete (&(commit->c_complete));



More information about the Ocfs2-commits mailing list