On 9/28/18 2:25 PM, Bart Van Assche wrote: > On Fri, 2018-09-28 at 08:54 -0600, Jens Axboe wrote: >> + for (z = zb; z < ze; z++) { >> + pthread_mutex_lock(&z->mutex); >> + swd += z->wp - z->start; >> + } >> + pthread_mutex_lock(&f->zbd_info->mutex); >> >> Can 'z' ever end up being f->zbd_info? That would surely explain the >> deadlock. > > Hi Jens, > > f->zbd_info and z have a different type so unless something very weird is going > on &z->mutex can't be identical to &f->zbd_info->mutex. Obviously I didn't look too closely :-) > What I think is going on is traditional lock inversion: check_swd() triggers > lock inversion if it is called while any of the z->mutex objects are held. One > such mutex is held where Damien tried to restore the calls of this function. I > will submit a patch that inserts these calls elsewhere. That makes sense. -- Jens Axboe