Chinaunix首页 | 论坛 | 博客
  • 博客访问: 511277
  • 博文数量: 118
  • 博客积分: 2575
  • 博客等级: 大尉
  • 技术积分: 1263
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-27 09:37
文章分类

全部博文(118)

文章存档

2017年(11)

2016年(8)

2015年(1)

2014年(9)

2013年(7)

2012年(38)

2011年(14)

2010年(18)

2009年(12)

分类: 系统运维

2011-11-30 12:12:43

一个客户的发现我们的设备上出现了arpFlush处挂起的现象,看了一下代码,发现arpFlush中存在竞争条件,即代码中获取arp_llinfo链表信息时,没有处于spnet之下,所以会导致原本有效的链表节点,在进入spnet保护的临界区之后,实际上可能被其它任务释放,从而导致任务挂起。代码如下,出问题的就是第一行代码。

  1. void arpFlush (void)
  2.     {
  3.     struct llinfo_arp * la = arp_llinfo.lh_first;
  4.     struct llinfo_arp * ola;
  5.     struct rtentry *rt;
  6.     int    s;

  7.     s = splnet ();

  8.     while ((ola = la) != 0)
  9.     {
  10.         rt = la->la_rt;
  11.     la = la->la_le.le_next;

  12.     /* if entry permanent */
  13.     if ((rt->rt_rmx.rmx_expire == 0) || (rt->rt_flags == 0))
  14.      continue;

  15.     arptfree(ola); /* timer has expired; clear */
  16.     }

  17.     splx (s);
  18.     }
阅读(2647) | 评论(4) | 转发(3) |
给主人留下些什么吧!~~

areece2011-12-04 13:23:03

147189385: arp问题啊,代码挺简练的.....
是Vxworks的源代码。

1471893852011-12-04 01:48:53

arp问题啊,代码挺简练的

重返人生2011-12-01 23:38:16

没有处于spnet之下,所以会导致原本有效的链表节点

十七岁的回忆2011-12-01 00:08:52

了然~