- thread_pid is a long, not an int (on most arches)
- only kill the thread if its pid > 0
- wake the sleeping kernel thread so it can die gracefully

Signed-off-by: Matt Domsch <[EMAIL PROTECTED]

-- 
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com



Index: linux-2.6.ipmi/drivers/char/ipmi/ipmi_si_intf.c
===================================================================
--- linux-2.6.ipmi.orig/drivers/char/ipmi/ipmi_si_intf.c        2005-10-20 
10:35:43.%N -0500
+++ linux-2.6.ipmi/drivers/char/ipmi/ipmi_si_intf.c     2005-10-20 16:13:17.%N 
-0500
@@ -223,7 +223,7 @@
        unsigned long incoming_messages;
 
         struct completion exiting;
-        int               thread_pid;
+        long              thread_pid;
 };
 
 static struct notifier_block *xaction_notifier_list;
@@ -789,6 +789,7 @@
        enum si_sm_result smi_result;
 
        daemonize("kipmi%d", smi_info->intf_num);
+       allow_signal(SIGKILL);
        set_user_nice(current, 19);
        while (!atomic_read(&smi_info->stop_operation)) {
                schedule_timeout(last);
@@ -807,6 +808,7 @@
                        current->state = TASK_INTERRUPTIBLE;
                }
        }
+       smi_info->thread_pid = 0;
        complete_and_exit(&(smi_info->exiting), 0);
        return 0;
 }
@@ -2210,9 +2212,11 @@
 
 static inline void wait_for_timer_and_thread(struct smi_info *smi_info)
 {
-       if (smi_info->thread_pid)
+       if (smi_info->thread_pid > 0) {
+               /* wake the potentially sleeping thread */
+               kill_proc(smi_info->thread_pid, SIGKILL, 0);
                wait_for_completion(&(smi_info->exiting));
-
+       }
        del_timer_sync(&smi_info->si_timer);
 }
 
@@ -2344,7 +2348,7 @@
        new_smi->si_timer.expires = jiffies + SI_TIMEOUT_JIFFIES;
 
        add_timer(&(new_smi->si_timer));
-       if (new_smi->si_type != SI_BT){
+       if (new_smi->si_type != SI_BT) {
                init_completion(&(new_smi->exiting));
                new_smi->thread_pid = kernel_thread(ipmi_thread, new_smi,
                                                    CLONE_FS|CLONE_FILES|
@@ -2499,7 +2503,6 @@
        spin_lock(&(to_clean->msg_lock));
 
        atomic_inc(&to_clean->stop_operation);
-
        to_clean->irq_cleanup(to_clean);
 
        spin_unlock(&(to_clean->msg_lock));


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer

Reply via email to