All of lore.kernel.org
 help / color / mirror / Atom feed
From: "jianchao.wang" <jianchao.w.wang@oracle.com>
To: Tejun Heo <tj@kernel.org>
Cc: jbacik@fb.com, jack@suse.cz, axboe@kernel.dk, clm@fb.com,
	kernel-team@fb.com, linux-kernel@vger.kernel.org,
	linux-btrfs@vger.kernel.org, peterz@infradead.org,
	Bart.VanAssche@wdc.com
Subject: Re: [PATCH 5/7] blk-mq: remove REQ_ATOM_COMPLETE usages from blk-mq
Date: Fri, 22 Dec 2017 12:02:20 +0800	[thread overview]
Message-ID: <4e5aa629-f341-d077-961b-c778ceb31154@oracle.com> (raw)
In-Reply-To: <20171221135051.GE1084507@devbig577.frc2.facebook.com>

Sorry for my non-detailed description. 

On 12/21/2017 09:50 PM, Tejun Heo wrote:
> Hello,
> 
> On Thu, Dec 21, 2017 at 11:56:49AM +0800, jianchao.wang wrote:
>> It's worrying that even though the blk_mark_rq_complete() here is intended to synchronize with
>> timeout path, but it indeed give the blk_mq_complete_request() the capability to exclude with 
There could be scenario where the driver itself stop a request itself with blk_mq_complete_request() or
some other interface that will invoke it, races with the normal completion path where a same request comes.
For example:
a reset could be triggered through sysfs on nvme-rdma
Then the driver will cancel all the reqs, including in-flight ones.
nvme_rdma_reset_ctrl_work()
    nvme_rdma_shutdown_ctrl()
    >>>>
        if (ctrl->ctrl.queue_count > 1) {
            nvme_stop_queues(&ctrl->ctrl); //quiesce the queue
            blk_mq_tagset_busy_iter(&ctrl->tag_set,
                        nvme_cancel_request, &ctrl->ctrl); //invoke blk_mq_complete_request()
            nvme_rdma_destroy_io_queues(ctrl, shutdown);
        }
    >>>>

These operations could race with the normal completion path of in-flight ones.
It should drain all the in-flight ones first here. But there maybe some other
places similar with this.
 
>> itself. Maybe this capability should be reserved.
> 
> Can you explain further how that'd help?  The problem there is that if
> you have two competing completions, where one isn't a timeout, there's
> nothing synchronizing the reuse of the request.  IOW, the losing on
> can easily complete the next recycle instance.  The atomic bitops
> might feel like more protection but it's just feels.

In above case, the request may simultaneously enter requeue and end path.

Thanks
Jianchao

  reply	other threads:[~2017-12-22  4:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-16 12:07 [PATCHSET v3] blk-mq: reimplement timeout handling Tejun Heo
2017-12-16 12:07 ` [PATCH 1/7] blk-mq: protect completion path with RCU Tejun Heo
2017-12-29 10:04   ` Christoph Hellwig
2018-01-08 17:12     ` Tejun Heo
2017-12-16 12:07 ` [PATCH 2/7] blk-mq: replace timeout synchronization with a RCU and generation based scheme Tejun Heo
2017-12-16 12:07 ` [PATCH 3/7] blk-mq: use blk_mq_rq_state() instead of testing REQ_ATOM_COMPLETE Tejun Heo
2017-12-16 12:07 ` [PATCH 4/7] blk-mq: make blk_abort_request() trigger timeout path Tejun Heo
2017-12-29 10:07   ` Christoph Hellwig
2017-12-16 12:07 ` [PATCH 5/7] blk-mq: remove REQ_ATOM_COMPLETE usages from blk-mq Tejun Heo
2017-12-21  3:56   ` jianchao.wang
2017-12-21 13:50     ` Tejun Heo
2017-12-22  4:02       ` jianchao.wang [this message]
2018-01-08 17:27         ` Tejun Heo
2018-01-09  3:08           ` jianchao.wang
2018-01-09  3:37             ` Tejun Heo
2018-01-09  5:59               ` jianchao.wang
2017-12-16 12:07 ` [PATCH 6/7] blk-mq: remove REQ_ATOM_STARTED Tejun Heo
2017-12-16 12:07 ` [PATCH 7/7] blk-mq: rename blk_mq_hw_ctx->queue_rq_srcu to ->srcu Tejun Heo
2017-12-29 10:02 ` [PATCHSET v3] blk-mq: reimplement timeout handling Christoph Hellwig
2018-01-08 17:03   ` Tejun Heo

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=4e5aa629-f341-d077-961b-c778ceb31154@oracle.com \
    --to=jianchao.w.wang@oracle.com \
    --cc=Bart.VanAssche@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=clm@fb.com \
    --cc=jack@suse.cz \
    --cc=jbacik@fb.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tj@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.