Re: [1/2] tun: Only free a netdev when all tun descriptors are closed

2009-04-24 Thread Christian Borntraeger
Am Friday 24 April 2009 14:11:56 schrieb Herbert Xu: > The patch you qouted has been superceded by many versions :) Yes, I got lost in this mail thread... > Can you please test the latest that's in davem's tree? Done. With http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fdavem%2Fnet-2.6.git;a=co

Re: [1/2] tun: Only free a netdev when all tun descriptors are closed

2009-04-24 Thread Herbert Xu
On Fri, Apr 24, 2009 at 10:55:49AM +0200, Christian Borntraeger wrote: > Am Thursday 16 April 2009 13:08:18 schrieb Herbert Xu: > > > Here's the patch. I'd appreciate if everyone can review it > > and see if they can recreate the original race by > > > > 1) Starting a process using tun and polls

Re: [1/2] tun: Only free a netdev when all tun descriptors are closed

2009-04-24 Thread Christian Borntraeger
Am Thursday 16 April 2009 13:08:18 schrieb Herbert Xu: > On Wed, Apr 15, 2009 at 10:38:34PM +0800, Herbert Xu wrote: > > > > So how about this? We replace the dev destructor with our own that > > doesn't immediately call free_netdev. We only call free_netdev once > > all tun fd's attached to the

Re: [1/2] tun: Only free a netdev when all tun descriptors are closed

2009-04-18 Thread Herbert Xu
On Sat, Apr 18, 2009 at 10:09:39PM +0300, Michael S. Tsirkin wrote: > > Does this work with TUN_PERSIST off? > I haven't tested this, but won't unregister_netdev block forever > waiting for device reference to become 0? Maybe you want > > + tun_put(tun); > + if (!(tun->fla

Re: [1/2] tun: Only free a netdev when all tun descriptors are closed

2009-04-18 Thread Michael S. Tsirkin
On Fri, Apr 17, 2009 at 08:09:23AM +0800, Herbert Xu wrote: > On Thu, Apr 16, 2009 at 10:57:45PM +0300, Michael S. Tsirkin wrote: > > > > This last bit seems to make a simple test using a non-persistent tap device > > deadlock for me: we don't drop a reference acquired with __tun_get sock > > unreg

Re: [1/2] tun: Only free a netdev when all tun descriptors are closed

2009-04-16 Thread Herbert Xu
On Thu, Apr 16, 2009 at 10:57:45PM +0300, Michael S. Tsirkin wrote: > > This last bit seems to make a simple test using a non-persistent tap device > deadlock for me: we don't drop a reference acquired with __tun_get sock > unregister_netdevice blocks printing unregister_netdevice: waiting for tap0

Re: [1/2] tun: Only free a netdev when all tun descriptors are closed

2009-04-16 Thread Michael S. Tsirkin
On Thu, Apr 16, 2009 at 01:08:18AM -, Herbert Xu wrote: > On Wed, Apr 15, 2009 at 10:38:34PM +0800, Herbert Xu wrote: > > > > So how about this? We replace the dev destructor with our own that > > doesn't immediately call free_netdev. We only call free_netdev once > > all tun fd's attached to

[1/2] tun: Only free a netdev when all tun descriptors are closed

2009-04-16 Thread Herbert Xu
On Wed, Apr 15, 2009 at 10:38:34PM +0800, Herbert Xu wrote: > > So how about this? We replace the dev destructor with our own that > doesn't immediately call free_netdev. We only call free_netdev once > all tun fd's attached to the device have been closed. Here's the patch. I'd appreciate if ev