Linux block layer
 help / color / mirror / Atom feed
From: Mike Christie <mchristi@redhat.com>
To: Josef Bacik <josef@toxicpanda.com>
Cc: xiubli@redhat.com, axboe@kernel.dk, linux-block@vger.kernel.org
Subject: Re: [PATCH v4 2/2] nbd: fix possible page fault for nbd disk
Date: Tue, 17 Sep 2019 14:44:09 -0500	[thread overview]
Message-ID: <5D813789.1050400@redhat.com> (raw)
In-Reply-To: <20190917184011.74ityetkw7n3sqbs@MacBook-Pro-91.local>

On 09/17/2019 01:40 PM, Josef Bacik wrote:
>>> +		nbd->destroy_complete = &destroy_complete;
>>
>> Also, without the mutex part of the v3 patch, we could race and
>> nbd_dev_remove could have passed the destroy_complete check already, so
>> below we will wait forever.
>>
> 
> Oh hmm you're right,

I think I am actually wrong about that part too now :) I had forgot
about the idr removal under the mutex when making my original comment.

If nbd_put grabs the mutex first then it will do idr_remove under the
mutex. If nbd_genl_connect then runs, idr_find/idr_for_each will fail
and we will allocate a new nbd device and NBD_DISCONNECT_REQUESTED will
not be set.

If nbd_genl_connect grabs the mutex first, then idr_find/idr_for_each
will succeed and we will set the completion. nbd_put will then grab the
mutex and call nbd_remove_dev and see the completion.

  parent reply	other threads:[~2019-09-17 19:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-17 11:56 [PATCH v4 0/2] nbd: fix possible page fault for nbd disk xiubli
2019-09-17 11:56 ` [PATCH v4 1/2] nbd: rename the runtime flags as NBD_RT_ prefixed xiubli
2019-09-17 11:56 ` [PATCH v4 2/2] nbd: fix possible page fault for nbd disk xiubli
2019-09-17 18:31   ` Mike Christie
2019-09-17 18:40     ` Josef Bacik
2019-09-17 19:36       ` Mike Christie
2019-09-17 19:44       ` Mike Christie [this message]
2019-09-17 19:56         ` Josef Bacik
2019-09-17 18:15 ` [PATCH v4 0/2] " Josef Bacik
2019-09-17 20:52 ` Jens Axboe

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=5D813789.1050400@redhat.com \
    --to=mchristi@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=xiubli@redhat.com \
    /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