[Ocfs2-commits] mfasheh commits r1371 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Aug 23 18:35:54 CDT 2004
Author: mfasheh
Date: 2004-08-23 18:35:52 -0500 (Mon, 23 Aug 2004)
New Revision: 1371
Modified:
trunk/src/journal.c
trunk/src/nm.c
trunk/src/ocfs.h
trunk/src/ocfs_compat.h
trunk/src/util.c
trunk/src/util.h
Log:
* Don't use signals for most of our kernel threads now. This has the
effect of fixing bug 116.
Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c 2004-08-20 22:23:01 UTC (rev 1370)
+++ trunk/src/journal.c 2004-08-23 23:35:52 UTC (rev 1371)
@@ -1148,17 +1148,14 @@
* the commit thread will take the trans lock for us below. */
journal->state = OCFS_JOURNAL_IN_SHUTDOWN;
- /* wake the commit thread */
- atomic_set (&osb->flush_event_woken, 1);
- wake_up (&osb->flush_event);
-
/* The OCFS_JOURNAL_IN_SHUTDOWN will signal to commit_cache to not
* drop the trans_lock (which we want to hold until we
* completely destroy the journal. */
if (osb->commit && osb->commit->c_task) {
/* Wait for the commit thread */
LOG_TRACE_STR ("Waiting for ocfs2commit to exit....");
- send_sig (SIGINT, osb->commit->c_task, 0);
+ atomic_set (&osb->flush_event_woken, 1);
+ wake_up (&osb->flush_event);
wait_for_completion(&osb->commit->c_complete);
osb->commit->c_task = NULL;
kfree(osb->commit);
@@ -1347,7 +1344,7 @@
osb->node_num);
sprintf (proc, "ocfs2rec-%d", osb->osb_id);
- ocfs_daemonize (proc, strlen(proc));
+ ocfs_daemonize (proc, strlen(proc), 0);
#ifdef HAVE_NPTL
spin_lock_irq (¤t->sighand->siglock);
@@ -1807,7 +1804,7 @@
int ocfs_commit_thread(void *arg)
{
- int status = 0, misses = 0, finish = 0;
+ int status = 0, misses = 0;
ocfs_super *osb = arg;
ocfs_commit_task *commit = osb->commit;
char name[16];
@@ -1815,14 +1812,12 @@
siginfo_t info;
sprintf (name, "ocfs2cmt-%d", osb->osb_id);
- ocfs_daemonize (name, strlen(name));
+ ocfs_daemonize (name, strlen(name), 0);
commit->c_task = current;
misses = 0;
- while (!(OcfsGlobalCtxt.flags & OCFS_FLAG_SHUTDOWN_VOL_THREAD) &&
- !(osb->osb_flags & OCFS_OSB_FLAGS_BEING_DISMOUNTED)) {
-
+ while (1) {
status = ocfs_wait (osb->flush_event,
atomic_read (&osb->flush_event_woken),
OCFS_CHECKPOINT_INTERVAL);
@@ -1834,19 +1829,13 @@
LOG_TRACE_STR("FLUSH_EVENT: timed out");
break;
case -EINTR:
- /* journal shutdown has asked me to do
- * one last commit cache and then exit */
- if (journal->state == OCFS_JOURNAL_IN_SHUTDOWN)
- finish = 1;
-
+ LOG_ERROR_STR("Commit thread got a signal!");
/* ignore the actual signal */
if (signal_pending(current)) {
dequeue_signal_lock(current,
¤t->blocked,
&info);
}
-
- LOG_TRACE_STR("FLUSH_EVENT: interrupted");
break;
case 0:
LOG_TRACE_STR("FLUSH_EVENT: woken!!!");
@@ -1856,20 +1845,16 @@
break;
}
- if ((OcfsGlobalCtxt.flags & OCFS_FLAG_SHUTDOWN_VOL_THREAD) ||
- (osb->osb_flags & OCFS_OSB_FLAGS_BEING_DISMOUNTED))
- finish = 1;
-
status = ocfs_commit_cache(osb);
if (status < 0)
LOG_ERROR_STATUS(status);
- if (finish)
+ /* journal shutdown has asked me to do
+ * one last commit cache and then exit */
+ if (journal->state == OCFS_JOURNAL_IN_SHUTDOWN)
break;
}
- /* Flush all scheduled tasks */
- flush_scheduled_work();
complete (&(commit->c_complete));
return 0;
}
Modified: trunk/src/nm.c
===================================================================
--- trunk/src/nm.c 2004-08-20 22:23:01 UTC (rev 1370)
+++ trunk/src/nm.c 2004-08-23 23:35:52 UTC (rev 1371)
@@ -111,7 +111,8 @@
LOG_ENTRY ();
#define LISTENER_PROCESS_NAME "ocfs2lsnr"
- ocfs_daemonize (LISTENER_PROCESS_NAME, strlen(LISTENER_PROCESS_NAME));
+ ocfs_daemonize (LISTENER_PROCESS_NAME, strlen(LISTENER_PROCESS_NAME),
+ 1);
OcfsIpcCtxt.task = current;
@@ -276,7 +277,7 @@
osb = arg;
sprintf (proc, "ocfs2nm-%d", osb->osb_id);
- ocfs_daemonize (proc, strlen(proc));
+ ocfs_daemonize (proc, strlen(proc), 1);
osb->dlm_task = current;
@@ -1564,7 +1565,9 @@
#define OCFS_DROP_RO_THREAD_NAME "ocfs2dropro"
- ocfs_daemonize (OCFS_DROP_RO_THREAD_NAME, strlen(OCFS_DROP_RO_THREAD_NAME));
+ ocfs_daemonize (OCFS_DROP_RO_THREAD_NAME,
+ strlen(OCFS_DROP_RO_THREAD_NAME),
+ 0);
status = _ocfs_drop_readonly_cache_lock(arg);
/* ignore the actual signal */
Modified: trunk/src/ocfs.h
===================================================================
--- trunk/src/ocfs.h 2004-08-20 22:23:01 UTC (rev 1370)
+++ trunk/src/ocfs.h 2004-08-23 23:35:52 UTC (rev 1371)
@@ -272,13 +272,6 @@
} \
} while (0)
-static inline int ocfs_task_interruptible(void)
-{
- return (signal_pending(current) &&
- (sigismember(&(current->pending.signal), SIGKILL) ||
- sigismember(&(current->pending.signal), SIGINT)));
-}
-
/*
** Macros
*/
Modified: trunk/src/ocfs_compat.h
===================================================================
--- trunk/src/ocfs_compat.h 2004-08-20 22:23:01 UTC (rev 1370)
+++ trunk/src/ocfs_compat.h 2004-08-23 23:35:52 UTC (rev 1371)
@@ -132,7 +132,35 @@
dequeue_signal(blocked, info);
spin_unlock_irq(&task->sighand->siglock);
}
+static inline int ocfs_task_interruptible(void)
+{
+ unsigned long flags;
+ int ret = 0;
+
+ if (signal_pending(current)) {
+ spin_lock_irqsave(&(current->sighand->siglock), flags);
+ if (sigismember(&(current->pending.signal), SIGKILL) ||
+ sigismember(&(current->pending.signal), SIGINT))
+ ret = 1;
+ spin_unlock_irqrestore(¤t->sighand->siglock, flags);
+ }
+ return(ret);
+}
#else
+static inline int ocfs_task_interruptible(void)
+{
+ unsigned long flags;
+ int ret = 0;
+
+ if (signal_pending(current)) {
+ spin_lock_irqsave(&(current->sigmask_lock), flags);
+ if (sigismember(&(current->pending.signal), SIGKILL) ||
+ sigismember(&(current->pending.signal), SIGINT))
+ ret = 1;
+ spin_unlock_irqrestore(&(current->sigmask_lock), flags);
+ }
+ return(ret);
+}
static inline void dequeue_signal_lock(struct task_struct *task,
sigset_t *blocked, siginfo_t *info)
{
@@ -161,6 +189,20 @@
#define ocfs_get_seconds(t) ((t).tv_sec)
+static inline int ocfs_task_interruptible(void)
+{
+ unsigned long flags;
+ int ret = 0;
+
+ if (signal_pending(current)) {
+ spin_lock_irqsave(&(current->sighand->siglock), flags);
+ if (sigismember(&(current->pending.signal), SIGKILL) ||
+ sigismember(&(current->pending.signal), SIGINT))
+ ret = 1;
+ spin_unlock_irqrestore(¤t->sighand->siglock, flags);
+ }
+ return(ret);
+}
#endif /* LINUX_VERSION_CODE < 2.6 */
#ifndef BITS_TO_LONGS
Modified: trunk/src/util.c
===================================================================
--- trunk/src/util.c 2004-08-20 22:23:01 UTC (rev 1370)
+++ trunk/src/util.c 2004-08-23 23:35:52 UTC (rev 1371)
@@ -52,24 +52,39 @@
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
/* yes, len is unused but kept here for backwards compatibility. */
-void ocfs_daemonize (char *name, int len)
+void ocfs_daemonize (char *name, int len, int shutdown_sigs)
{
sigset_t tmpsig;
daemonize (name);
- /* Unblock SIGKILL, SIGSTOP, SIGHUP and SIGINT */
- sigemptyset(&tmpsig);
- sigaddsetmask(&tmpsig, SHUTDOWN_SIGS);
- sigprocmask(SIG_UNBLOCK, &tmpsig, NULL);
+ if (shutdown_sigs) {
+ /* Unblock SIGKILL, SIGSTOP, SIGHUP and SIGINT */
+ sigemptyset(&tmpsig);
+ sigaddsetmask(&tmpsig, SHUTDOWN_SIGS);
+ sigprocmask(SIG_UNBLOCK, &tmpsig, NULL);
+ }
return;
} /* ocfs_daemonize */
#else
-void ocfs_daemonize (char *name, int len)
+
+static inline void ocfs_block_sigs(unsigned long mask)
{
- sigset_t tmpsig;
-
+#ifdef HAVE_NPTL
+ spin_lock_irq (¤t->sighand->siglock);
+ siginitsetinv (¤t->blocked, mask);
+ recalc_sigpending ();
+ spin_unlock_irq (¤t->sighand->siglock);
+#else
+ spin_lock_irq (¤t->sigmask_lock);
+ siginitsetinv (¤t->blocked, mask);
+ recalc_sigpending (current);
+ spin_unlock_irq (¤t->sigmask_lock);
+#endif
+}
+void ocfs_daemonize (char *name, int len, int shutdown_sigs)
+{
daemonize ();
reparent_to_init ();
@@ -80,21 +95,10 @@
current->comm[len] = '\0';
}
- /* Block all signals except SIGKILL, SIGSTOP, SIGHUP and SIGINT */
-#ifdef HAVE_NPTL
- spin_lock_irq (¤t->sighand->siglock);
- tmpsig = current->blocked;
- siginitsetinv (¤t->blocked, SHUTDOWN_SIGS);
- recalc_sigpending ();
- spin_unlock_irq (¤t->sighand->siglock);
-#else
- spin_lock_irq (¤t->sigmask_lock);
- tmpsig = current->blocked;
- siginitsetinv (¤t->blocked, SHUTDOWN_SIGS);
- recalc_sigpending (current);
- spin_unlock_irq (¤t->sigmask_lock);
-#endif
-
+ if (shutdown_sigs)
+ ocfs_block_sigs(SHUTDOWN_SIGS);
+ else
+ ocfs_block_sigs(0);
return;
} /* ocfs_daemonize */
#endif
Modified: trunk/src/util.h
===================================================================
--- trunk/src/util.h 2004-08-20 22:23:01 UTC (rev 1370)
+++ trunk/src/util.h 2004-08-23 23:35:52 UTC (rev 1371)
@@ -30,7 +30,7 @@
#define OCFS2_UTIL_H
void ocfs_clear_timeout(ocfs_timeout *to);
-void ocfs_daemonize(char *name, int len);
+void ocfs_daemonize(char *name, int len, int shutdown_sigs);
void ocfs_init_timeout(ocfs_timeout *to);
void ocfs_set_timeout(ocfs_timeout *to, __u32 timeout);
void ocfs_show_stack(unsigned long *esp);
More information about the Ocfs2-commits
mailing list