Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1601815

Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout handler

From Ming Lei <tom.leiming@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout handler
Date 2017-03-16 00:50 +0100
Message-ID <tlqQ2-6uq-13@gated-at.bofh.it> (permalink)
References <tj5Zo-5Ce-41@gated-at.bofh.it> <tj693-5FN-13@gated-at.bofh.it> <tlgdY-7yR-13@gated-at.bofh.it> <tlgdY-7yR-11@gated-at.bofh.it> <tlqQ2-6uq-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Mar 15, 2017 at 09:34:50PM +0000, Bart Van Assche wrote:
> On Wed, 2017-03-15 at 20:18 +0800, Ming Lei wrote:
> > On Wed, Mar 15, 2017 at 12:07:37AM +0000, Bart Van Assche wrote:
> > > Both the old and the new check look racy to me. The REQ_ATOM_STARTED bit can
> > > be changed concurrently by blk_mq_start_request(), __blk_mq_finish_request()
> > 
> > blk_mq_start_request() and __blk_mq_finish_request() won't be run concurrently.
> > 
> > From view of __blk_mq_finish_request():
> > 
> > 	- if it is run from merge queue io path(blk_mq_merge_queue_io()),
> > 	blk_mq_start_request() can't be run at all, and the COMPLETE flag
> > 	is kept as previous value(zero)
> > 
> > 	- if it is run from normal complete path, COMPLETE flag is cleared
> > 	before the req/tag is released to tag set.
> > 
> > so there isn't race in blk_mq_start_request() vs. __blk_mq_finish_request()
> > wrt. timeout.
> > 
> > > or __blk_mq_requeue_request(). Another issue with this function is that the
> > 
> > __blk_mq_requeue_request() can be run from two pathes:
> > 
> > 	- dispatch failure, in which case the req/tag isn't released to tag set
> > 	
> > 	- IO completion path, in which COMPLETE flag is cleared before requeue.
> > 	
> > so I can't see races with timeout in case of start rq vs. requeue rq. 
> > 
> > > request passed to this function can be reinitialized concurrently.
> 
> Hello Ming,
> 
> You misinterpret what I wrote. I was referring to manipulation of
> REQ_ATOM_STARTED from different contexts and not to what you explained.

This patch addresses one race between timeout and pre-queuing I/O in block layer
(before .queue_rq), please focus on this patch. And that is definitely correct.

Also I am happy to discuss this kind of races, but maybe we can do that in
another thread if you can describe the issue clearly.


-- 
Ming

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout  handler Ming Lei <tom.leiming@gmail.com> - 2017-03-15 13:30 +0100
  Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout  handler Ming Lei <tom.leiming@gmail.com> - 2017-03-15 13:50 +0100
    Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout  handler Ming Lei <tom.leiming@gmail.com> - 2017-03-15 17:30 +0100
      Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout  handler Ming Lei <tom.leiming@gmail.com> - 2017-03-15 17:50 +0100
      Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout  handler Ming Lei <tom.leiming@gmail.com> - 2017-03-16 01:10 +0100
        Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout handler Ming Lei <tom.leiming@gmail.com> - 2017-03-17 01:10 +0100
  Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout  handler Ming Lei <tom.leiming@gmail.com> - 2017-03-16 00:50 +0100

csiph-web