[sheepdog] [PATCH] sheep: implement a correct detection of object cache pushing completion

Liu Yuan namei.unix at gmail.com
Wed Jul 24 15:28:36 CEST 2013


On Wed, Jul 24, 2013 at 07:46:33PM +0900, Hitoshi Mitake wrote:
> Current implementation for pushing object cache would have a bug. In
> object_cache_push(), the variable oc->push_count is incremented in the
> loop of queuing work. This can produce a non deterministic bug when
> a sequence of scheduling like below happens:
> 
> 1. object_cache_push() creates a work and queue it to
>    sys->oc_push_wqueue (oc->push_count == 1)
> 2. Before queuing next work, a worker thread of oc_push_wqueue wakes
>    up and pushes the object
> 3. After completion of pushing, the worker thread decrements
>    oc->push_count atomically. The thread calls eventfd_write() because
>    oc->push_count is 0.
> 4. The thread which calls object_cache_push() detects an invalid
>    completion after its queuing iteration.
> 
> This sequence can produce an invalid early finish of flush request
> from VMs, especially when a number of cached object is large.

Applied thanks

Yuan



More information about the sheepdog mailing list