Re: [PATCH 1/1] net: Add rtnl_lock for netif_device_attach/detach

2014-04-22 Thread Ben Hutchings
On Wed, 2014-04-16 at 15:08 +0800, Li, Zhen-Hua wrote: > From: "Li, Zhen-Hua" > > As netif_running is called in netif_device_attach/detach. There should be > rtnl_lock/unlock called, to avoid dev stat change during netif_device_attach > and detach being called. > I checked NIC some drivers,

Re: [PATCH 1/1] net: Add rtnl_lock for netif_device_attach/detach

2014-04-22 Thread Ben Hutchings
On Wed, 2014-04-16 at 15:08 +0800, Li, Zhen-Hua wrote: From: Li, Zhen-Hua zhen-h...@hp.com As netif_running is called in netif_device_attach/detach. There should be rtnl_lock/unlock called, to avoid dev stat change during netif_device_attach and detach being called. I checked NIC some

Re: [PATCH 1/1] net: Add rtnl_lock for netif_device_attach/detach

2014-04-21 Thread Sergei Shtylyov
Hello. On 21-04-2014 10:30, Li, ZhenHua wrote: The comment is trying to explain why add a lock here. I can read, thanks. :-) I was wondering about the kernel-doc comment style you've used; AFAIK, it's only good for documenting functions and data structures. The normal multi-line

Re: [PATCH 1/1] net: Add rtnl_lock for netif_device_attach/detach

2014-04-21 Thread Li, ZhenHua
The comment is trying to explain why add a lock here. On 04/19/2014 03:01 AM, Sergei Shtylyov wrote: Hello. On 04/16/2014 11:08 AM, Li, Zhen-Hua wrote: From: "Li, Zhen-Hua" As netif_running is called in netif_device_attach/detach. There should be rtnl_lock/unlock called, to avoid dev

Re: [PATCH 1/1] net: Add rtnl_lock for netif_device_attach/detach

2014-04-21 Thread Li, ZhenHua
The comment is trying to explain why add a lock here. On 04/19/2014 03:01 AM, Sergei Shtylyov wrote: Hello. On 04/16/2014 11:08 AM, Li, Zhen-Hua wrote: From: Li, Zhen-Hua zhen-h...@hp.com As netif_running is called in netif_device_attach/detach. There should be rtnl_lock/unlock called, to

Re: [PATCH 1/1] net: Add rtnl_lock for netif_device_attach/detach

2014-04-21 Thread Sergei Shtylyov
Hello. On 21-04-2014 10:30, Li, ZhenHua wrote: The comment is trying to explain why add a lock here. I can read, thanks. :-) I was wondering about the kernel-doc comment style you've used; AFAIK, it's only good for documenting functions and data structures. The normal multi-line

Re: [PATCH 1/1] net: Add rtnl_lock for netif_device_attach/detach

2014-04-18 Thread Sergei Shtylyov
Hello. On 04/16/2014 11:08 AM, Li, Zhen-Hua wrote: From: "Li, Zhen-Hua" As netif_running is called in netif_device_attach/detach. There should be rtnl_lock/unlock called, to avoid dev stat change during netif_device_attach and detach being called. I checked NIC some drivers, some of them

Re: [PATCH 1/1] net: Add rtnl_lock for netif_device_attach/detach

2014-04-18 Thread Sergei Shtylyov
Hello. On 04/16/2014 11:08 AM, Li, Zhen-Hua wrote: From: Li, Zhen-Hua zhen-h...@hp.com As netif_running is called in netif_device_attach/detach. There should be rtnl_lock/unlock called, to avoid dev stat change during netif_device_attach and detach being called. I checked NIC some drivers,

Re: [PATCH 1/1] net: Add rtnl_lock for netif_device_attach/detach

2014-04-16 Thread Li, ZhenHua
The problem I am trying to fix is: when netif_device_attach/detached is called, it get a return value from netif_running, but at this moment, in another thread, the stat of this dev changes. But in netif_device_attach, it does not know stat changed, and this may cause bugs. I think you are

Re: [PATCH 1/1] net: Add rtnl_lock for netif_device_attach/detach

2014-04-16 Thread Veaceslav Falico
On Wed, Apr 16, 2014 at 03:08:02PM +0800, Li, Zhen-Hua wrote: From: "Li, Zhen-Hua" As netif_running is called in netif_device_attach/detach. There should be rtnl_lock/unlock called, to avoid dev stat change during netif_device_attach and detach being called. I checked NIC some drivers, some

[PATCH 1/1] net: Add rtnl_lock for netif_device_attach/detach

2014-04-16 Thread Li, Zhen-Hua
From: "Li, Zhen-Hua" As netif_running is called in netif_device_attach/detach. There should be rtnl_lock/unlock called, to avoid dev stat change during netif_device_attach and detach being called. I checked NIC some drivers, some of them have netif_device_attach/detach called between

[PATCH 1/1] net: Add rtnl_lock for netif_device_attach/detach

2014-04-16 Thread Li, Zhen-Hua
From: Li, Zhen-Hua zhen-h...@hp.com As netif_running is called in netif_device_attach/detach. There should be rtnl_lock/unlock called, to avoid dev stat change during netif_device_attach and detach being called. I checked NIC some drivers, some of them have netif_device_attach/detach called

Re: [PATCH 1/1] net: Add rtnl_lock for netif_device_attach/detach

2014-04-16 Thread Veaceslav Falico
On Wed, Apr 16, 2014 at 03:08:02PM +0800, Li, Zhen-Hua wrote: From: Li, Zhen-Hua zhen-h...@hp.com As netif_running is called in netif_device_attach/detach. There should be rtnl_lock/unlock called, to avoid dev stat change during netif_device_attach and detach being called. I checked NIC some

Re: [PATCH 1/1] net: Add rtnl_lock for netif_device_attach/detach

2014-04-16 Thread Li, ZhenHua
The problem I am trying to fix is: when netif_device_attach/detached is called, it get a return value from netif_running, but at this moment, in another thread, the stat of this dev changes. But in netif_device_attach, it does not know stat changed, and this may cause bugs. I think you are