Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1400123
| From | "Lino Sanfilippo" <LinoSanfilippo@gmx.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Aw: [PATCH 0/6] hv_netvsc: avoid races on mtu change/set channels |
| Date | 2016-05-12 17:00 +0200 |
| Message-ID | <ry0fL-80O-5@gated-at.bofh.it> (permalink) |
| References | <rxYdY-5WB-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi, > > MTU change and set channels operations are implemented as netvsc device > re-creation destroying internal structures (struct net_device stays). This > is really unfortunate but there is no support from Hyper-V host to do it > in a different way. Such re-creation is unsurprisingly racy, Haiyang > reported a crash when netvsc_change_mtu() is racing with > netvsc_link_change() but I was able to identify additional races upon > investigation. Both netvsc_set_channels() and netvsc_change_mtu() race > against: > 1) netvsc_link_change() > 2) netvsc_remove() > 3) netvsc_send() > after having a look into this driver I got the impression that you are working around an unfortunate implementation of the shutdown sequence in the remove function: If you do unregister_netdev() first instead of resource cleanup then neither set_channels() nor change_mtu() can race with remove(). This is since after unregister_netdev() returns the netdev is not longer available from userspace and thus neither set_channels nor change_mtu can be called anymore (note that all of these functions are protected by the rtnl_lock). To avoid the race between netvsc_change_mtu()/netvsc_set_channels() and netvsc_link_change() you have to stop the concerning worker thread (dwork) before you call netvsc_close() and restart it once the device is up again. Regards, Lino
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/6] hv_netvsc: avoid races on mtu change/set channels Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-05-12 14:50 +0200
[PATCH 5/6] hv_netvsc: synchronize netvsc_change_mtu()/netvsc_set_channels() with netvsc_remove() Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-05-12 15:00 +0200
[PATCH 6/6] hv_netvsc: set nvdev link after populating chn_table Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-05-12 15:00 +0200
[PATCH 4/6] hv_netvsc: get rid of struct net_device pointer in struct netvsc_device Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-05-12 15:00 +0200
[PATCH 3/6] hv_netvsc: untangle the pointer mess Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-05-12 15:00 +0200
Aw: [PATCH 0/6] hv_netvsc: avoid races on mtu change/set channels "Lino Sanfilippo" <LinoSanfilippo@gmx.de> - 2016-05-12 17:00 +0200
Re: Aw: [PATCH 0/6] hv_netvsc: avoid races on mtu change/set channels Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-05-12 17:10 +0200
Aw: Re: [PATCH 0/6] hv_netvsc: avoid races on mtu change/set channels "Lino Sanfilippo" <LinoSanfilippo@gmx.de> - 2016-05-12 18:20 +0200
csiph-web