[openib-general] Re: Re: [PATCH] cm refcount race fix
Michael S. Tsirkin
mst at mellanox.co.il
Mon May 8 09:19:47 PDT 2006
Quoting r. Roland Dreier <rdreier at cisco.com>:
> Subject: Re: Re: [PATCH] cm refcount race fix
>
> > atomic_dec(&obj->refcount);
> > wait_event(&obj->wait, !atomic_read(&obj->refcount))
> > spin_lock_irq(&obj->lock);
> > spin_unlock_irq(&obj->lock);
> > kfree(obj);
>
> Yeah, that seems to work. I wonder if there's a cleaner way though --
> this sort of empty locked section is not exactly idiomatic.
We can change refcount from atomic to a simple integer, protected
by lock. And then
wait_event(&obj->wait, ({
spin_lock_irq(&obj->lock);
count = obj->refcount;
spin_unlock_irq(&obj->lock);
count;
})
It's a big change though.
--
MST
More information about the general
mailing list