From: sagi@grimberg.me (Sagi Grimberg)
Subject: [PATCH] nvme-rdma: Fix early queue flags settings
Date: Wed, 21 Sep 2016 12:57:47 -0700 [thread overview]
Message-ID: <d7f41024-c76d-27a9-d08c-c3eca4295038@grimberg.me> (raw)
In-Reply-To: <00aa01d2141f$e1cd1020$a5673060$@opengridcomputing.com>
>>> Honestly there more I look into this the less I'm happy with the patch.
>>
>> I agree that we should really do a proper queue state machine.
>>
>>> queue->flags is an atomic, and as the patch shows we can get
>>> nvme_rdma_init_queue caled on a queue that still has visibility in
>>> other threads So I think we really should not even do that simple
>>> queue->flags = 0 assignment at all. We'll need to use clear_bit to
>>> atomically clear anything that might be set, and we need to be careful
>>> where we do that. I think this whole situation that we can get an
>>> *_init_* function called on something that already is live and visible
>>> to other threads need to be well documented at least because it's just
>>> waiting for sucker like me that don't expect that.
>>
>> I don't think its a multithreading issue. We aren't expected to get
>> here concurrently from different contexts (I think we're screwed if we
>> do). The issue was that we are not clearing the DELETING flag on
>> reconnects causing possible leaks, then I "fixed" it by resetting the
>> queue flags at init_queue start, the problem was that if we failed to
>> init the queue we lost the DELETING flag and got to a use-after-free
>> condition (nothing prevented stop_and_free_queue to make forward
>> progress...
>>
>> I can move it to clear_bit if you want...
>>
>
> I'd like this in 4.8 to avoid the crash during reconnect. (the clear_bit()
> is fine and tests ok).
>
> I'll sign up to work with Sagi on a proper state machine fix for 4.9. How's
> that sound?
Sounds good to me, I'll send out the clear_bit() version.
prev parent reply other threads:[~2016-09-21 19:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-20 18:57 [PATCH] nvme-rdma: Fix early queue flags settings Sagi Grimberg
2016-09-20 19:01 ` Steve Wise
2016-09-20 19:05 ` Sagi Grimberg
2016-09-20 20:08 ` Christoph Hellwig
2016-09-20 20:14 ` Steve Wise
2016-09-21 3:38 ` Sagi Grimberg
2016-09-21 14:01 ` 'Christoph Hellwig'
2016-09-21 14:18 ` Steve Wise
2016-09-21 14:52 ` Steve Wise
2016-09-21 15:10 ` Steve Wise
2016-09-21 14:36 ` Sagi Grimberg
2016-09-21 15:50 ` Steve Wise
2016-09-21 19:57 ` Sagi Grimberg [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=d7f41024-c76d-27a9-d08c-c3eca4295038@grimberg.me \
--to=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;
as well as URLs for NNTP newsgroup(s).