ChangeSet 1.2009.16.13, 2005/03/14 21:43:50-08:00, [EMAIL PROTECTED]

        [PKTGEN]: Fix thread_lock() usage.
        
        The current code bombs out with preemption enabled.
        
        Signed-off-by: David S. Miller <[EMAIL PROTECTED]>



 pktgen.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)


diff -Nru a/net/core/pktgen.c b/net/core/pktgen.c
--- a/net/core/pktgen.c 2005-03-15 00:10:08 -08:00
+++ b/net/core/pktgen.c 2005-03-15 00:10:08 -08:00
@@ -151,7 +151,7 @@
 #include <asm/timex.h>
 
 
-#define VERSION  "pktgen v2.59: Packet Generator for packet performance 
testing.\n"
+#define VERSION  "pktgen v2.60: Packet Generator for packet performance 
testing.\n"
 
 /* #define PG_DEBUG(a) a */
 #define PG_DEBUG(a) 
@@ -1419,7 +1419,6 @@
        if (debug) 
                printk("pktgen: t=%s, count=%lu\n", name, count);
         
-       thread_lock();
 
         t = (struct pktgen_thread*)(data);
        if(!t) {
@@ -1441,14 +1440,18 @@
                if( copy_from_user(f, &user_buffer[i], len) )
                        return -EFAULT;
                i += len;
+               thread_lock();
                 pktgen_add_device(t, f);
+               thread_unlock();
                 ret = count;
                 sprintf(pg_result, "OK: add_device=%s", f);
                goto out;
        }
 
         if (!strcmp(name, "rem_device_all")) {
+               thread_lock();
                t->control |= T_REMDEV;
+               thread_unlock();
                current->state = TASK_INTERRUPTIBLE;
                schedule_timeout(HZ/8);  /* Propagate thread->control  */
                ret = count;
@@ -1456,10 +1459,11 @@
                goto out;
        }
 
-
         if (!strcmp(name, "max_before_softirq")) {
                 len = num_arg(&user_buffer[i], 10, &value);
+               thread_lock();
                 t->max_before_softirq = value;
+               thread_unlock();
                 ret = count;
                 sprintf(pg_result, "OK: max_before_softirq=%lu", value);
                goto out;
@@ -1467,7 +1471,6 @@
 
        ret = -EINVAL;
  out:
-       thread_unlock();
 
        return ret;
 }
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to