Quoting r. Roland Dreier <[EMAIL PROTECTED]>:
> 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
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to