[openib-general] [PATCH fixed] was Re: [PATCH] ipoib_multicast/ipoib_mcast_send race

Michael S. Tsirkin mst at mellanox.co.il
Mon Dec 12 03:03:50 PST 2005


Quoting Krishna Kumar2 <krkumar2 at in.ibm.com>:
> stop_thread() 
> { 
>         clear_bit(); 
>         lock();        /* empty lock/unlock to synchronize with the mcast_send() */ 
>         unlock(); /* make the other routine FINISH before we start other activity */ 
>         ... 
>         ... 
> } 
> mcast_send() 
> { 
>         lock(); 
>         if (test_bit) 
>         ... 
>         ... 
>         unlock(); 
> } 

I think this will work, too. But I have easier time reasoning about locks than
barriers and atomic operations. "bit is protected by priv->lock" is a simple
rule, and we are not on data path here.

The fact that the race went unnoticed for a while validates this approach
in my eyes.

-- 
MST



More information about the general mailing list