Flexible I/O Tester development
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Bart Van Assche <bvanassche@acm.org>,
	Damien Le Moal <Damien.LeMoal@wdc.com>,
	"fio@vger.kernel.org" <fio@vger.kernel.org>
Subject: Re: [PATCH] zbd: Restore check_swd()
Date: Fri, 28 Sep 2018 14:31:09 -0600	[thread overview]
Message-ID: <382f413d-fb3f-6b7f-86cc-0e8dd4ffddea@kernel.dk> (raw)
In-Reply-To: <1538166304.53591.6.camel@acm.org>

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



      reply	other threads:[~2018-09-28 20:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-27  2:16 [PATCH] zbd: Restore check_swd() Damien Le Moal
2018-09-28  3:41 ` Bart Van Assche
2018-09-28  3:53 ` Jens Axboe
2018-09-28  4:04   ` Damien Le Moal
2018-09-28  5:48     ` Damien Le Moal
2018-09-28 14:54       ` Jens Axboe
2018-09-28 20:25         ` Bart Van Assche
2018-09-28 20:31           ` Jens Axboe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=382f413d-fb3f-6b7f-86cc-0e8dd4ffddea@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=Damien.LeMoal@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=fio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox