[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#6104) race condition with cancel operation



Hallvard B Furuseth wrote:
> hyc@symas.com writes:
>>> slapd/cancel.c sets o_abandon before o_cancel.  Thus it's possible for
>>> the canceled operation to obey o_abandon before o_cancel gets set.
>>
>> Cancel is just best-effort, why not just set o_cancel before o_abandon?
>
> Memory coherence.  Without mutex protection, the cancelled thread might
> still see the o_abandon change before the o_cancel change.  And thus not
> send a response, nor update info for the Cancel operation to react to.
>
I'd prefer to condense it all into a bitfield. We already ensure that the 
c_mutex is held when setting these flags. It would be a lot of overhead to 
grab the mutex just to read the flag, and would require additional analysis to 
make sure the new locking behavior doesn't introduce new deadlocks.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/