[Ocfs2-commits] mfasheh commits r819 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Mar 29 16:48:46 CST 2004
Author: mfasheh
Date: 2004-03-29 16:48:45 -0600 (Mon, 29 Mar 2004)
New Revision: 819
Modified:
trunk/src/journal.c
Log:
* handle signals in the commit thread properly. This helps umount
during reboot, and helps close a hole where a user could ruin ocfs
performance by sending a signal to the commit thread. Done with help
from Sonic Zhang <sonic.zhang at intel.com>
Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c 2004-03-29 22:46:42 UTC (rev 818)
+++ trunk/src/journal.c 2004-03-29 22:48:45 UTC (rev 819)
@@ -1745,6 +1745,7 @@
ocfs_commit_task *commit = osb->commit;
char name[16];
ocfs_journal * journal = &osb->journal;
+ siginfo_t info;
sprintf (name, "ocfs2cmt-%d", osb->osb_id);
ocfs_daemonize (name, strlen(name));
@@ -1765,7 +1766,24 @@
LOG_TRACE_STR("FLUSH_EVENT: timed out");
break;
case -EINTR:
- finish = 1;
+ /* journal shutdown has asked me to do
+ * one last commit cache and then exit */
+ if (journal->state == OCFS_JOURNAL_IN_SHUTDOWN)
+ finish = 1;
+ if (signal_pending(current)) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+ /* ignore the actual signal */
+ dequeue_signal_lock(current,
+ ¤t->blocked,
+ &info);
+#else
+ spin_lock_irq(¤t->sigmask_lock);
+ /* ignore the actual signal */
+ dequeue_signal(¤t->blocked,
+ &info);
+ spin_unlock_irq(¤t->sigmask_lock);
+#endif
+ }
LOG_TRACE_STR("FLUSH_EVENT: interrupted");
break;
case 0:
@@ -1778,7 +1796,7 @@
if ((OcfsGlobalCtxt.flags & OCFS_FLAG_SHUTDOWN_VOL_THREAD) ||
(osb->osb_flags & OCFS_OSB_FLAGS_BEING_DISMOUNTED))
- break;
+ finish = 1;
//if (!osb->needs_flush && status != 0)
// continue;
@@ -1788,18 +1806,13 @@
if (down_trylock(&osb->trans_lock) != 0) {
LOG_TRACE_ARGS("commit thread: trylock failed, miss=%d\n", misses);
- if (++misses < OCFS_COMMIT_MISS_MAX)
+ if (++misses < OCFS_COMMIT_MISS_MAX && finish == 0)
continue;
LOG_TRACE_ARGS("commit thread: about to down\n");
down(&osb->trans_lock);
misses = 0;
}
- /* journal shutdown has asked me to do one last commit cache */
- /* this commit cache will leave trans lock held! */
- if (journal->state == OCFS_JOURNAL_IN_SHUTDOWN)
- finish = 1;
-
status = ocfs_commit_cache (osb, false);
if (status < 0)
LOG_ERROR_STATUS(status);
More information about the Ocfs2-commits
mailing list