From: Logan Gunthorpe <logang@deltatee.com>
To: Sagi Grimberg <sagi@grimberg.me>,
linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org
Cc: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>,
Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 2/2] nvme-core: Fix deadlock when deleting the ctrl while scanning
Date: Wed, 24 Jul 2019 13:12:03 -0600 [thread overview]
Message-ID: <021b5195-9a09-4cc2-064f-940ada9cf764@deltatee.com> (raw)
In-Reply-To: <dd287560-2cb3-28ab-c22d-fe9f3682c609@grimberg.me>
Hey,
Sorry for the delay.
I tested your patch and it does work. Do you want me to send your change
as a full patch? Can I add your signed-off-by?
On 2019-07-18 6:50 p.m., Sagi Grimberg wrote:
>> I didn't think the scan_lock was that contested or that
>> nvme_change_ctrl_state() was really called that often...
>
> it shouldn't be, but I think it makes the flow more convoluted
> as we serialize by flushing the scan_work right after...
I would argue that the check for state in nvme_scan_work() without a
lock is racy and confusing. There's nothing to prevent the state from
changing immediately after the check.
> The design principal is met as we do get the I/O failing,
> but its just that with mpath we simply queue the I/O again
> because the head->list happens to not be empty.
> Perhaps taking care of that check is cleaner.
Yes, I feel your patch is a good solution on it's own merits.
> Thanks. Do you have a firm reproducer for it?
Yes. If you connect to and then immediately disconnect from a target (at
least with nvme-loop) you will reliably trigger this bug -- or one of
the others I've sent patches for.
>>>> + mutex_lock(&ctrl->scan_lock);
>>>> +
>>>> if (ctrl->state != NVME_CTRL_LIVE)
>>>> return;
>>>
>>> unlock
>>
>> If we unlock here and relock below, we'd have to recheck the ctrl->state
>> to avoid any races. If you don't want to call nvme_identify_ctrl with
>> the lock held, then it would probably be better to move the state check
>> below it.
>
> Meant before the return statement.
Ah, right, my mistake.
Logan
next prev parent reply other threads:[~2019-07-24 19:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-18 22:51 [PATCH 1/2] nvme-core: Fix extra device_put() call on error path Logan Gunthorpe
2019-07-18 22:51 ` [PATCH 2/2] nvme-core: Fix deadlock when deleting the ctrl while scanning Logan Gunthorpe
2019-07-19 0:25 ` Sagi Grimberg
2019-07-19 0:31 ` Sagi Grimberg
2019-07-19 20:15 ` Sagi Grimberg
2019-07-19 0:39 ` Logan Gunthorpe
2019-07-19 0:50 ` Sagi Grimberg
2019-07-24 19:12 ` Logan Gunthorpe [this message]
2019-07-25 18:16 ` Sagi Grimberg
2019-07-25 18:20 ` Logan Gunthorpe
2019-07-18 23:52 ` [PATCH 1/2] nvme-core: Fix extra device_put() call on error path Sagi Grimberg
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=021b5195-9a09-4cc2-064f-940ada9cf764@deltatee.com \
--to=logang@deltatee.com \
--cc=axboe@fb.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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
all inboxes | Powered by JetHome®