Messages in this thread | | | Date | Mon, 29 Aug 2005 00:16:58 +0800 | From | mandy london <> | Subject | the race condition will occur in below code ? |
| |
below is my script in brief, when it runs for several minutes , the computer will reboot quickly without any information , so I can not get knowledge form oops and something else .
I use timer and hook respectively, first , using hook to receive packets from ICP/IP stack on wired interface, the store it in a queue , then , when the timer arrive , the timer will invoke the dev_queue_xmit() to send the whole packets from wireless interface.
void timer_ack(unsigned long no_used){ int i ; struct sk_buff * skb; struct net_device * wireless; wireless = dev_get_by_name("eth1");//eth1 is wireless interface while((skb=skb_dequeue(packet_queue))!=NULL){// get out a packet from the queue dev_queue_xmit(skb); } mod_timer(&timer,100);// change time for polling one time per second
}
unsigned int hook_func(unsigned int hooknum,struct sk_buff **skb, const struct net_device *in,const struct net_device *out,int (*okfn)(struct sk_buff *)){ // there , I omit some the code handling the packet for the purpose of forwording like NAT , that means I will handle the packet firstly then I will insert it to the packet_queue
struct sk_buff *sb = *skb; skb_queue_tail(packet_queue,sb); }
I test it , normally it can run for about five minutes , then died without anyting info. I analyze whether my improper handling on queue leads to it. maybe there are some race conditions I can not find out.
the most important is whether the case below have the posibility to occur? when the kernel run in timer then an interrupt comes , after the interrupt return results in scheule or the hook_func()'s running , then the race condition will occur , I am not clear in this .
any help will be appreciated , thx~ :) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |