On Thu, Aug 31, 2017 at 10:50:25PM +0000, Bart Van Assche wrote:
> On Fri, 2017-09-01 at 01:27 +0800, Ming Lei wrote:
> > @@ -1413,9 +1414,17 @@ static struct request *blk_old_get_request(struct 
> > request_queue *q,
> >     /* create ioc upfront */
> >     create_io_context(gfp_mask, q->node);
> >  
> > -   ret = blk_queue_enter(q, !(gfp_mask & __GFP_DIRECT_RECLAIM));
> > +   /*
> > +    * When queue is frozen, we still need to allocate req for
> > +    * REQF_PREEMPT.
> > +    */
> > +   if ((flags & BLK_MQ_REQ_PREEMPT) && blk_queue_is_frozen(q))
> > +           blk_queue_enter_live(q);
> > +   else
> > +           ret = blk_queue_enter(q, !(gfp_mask & __GFP_DIRECT_RECLAIM));
> 
> Hello Ming,
> 
> Sorry but I doubt that calling blk_queue_enter_live() from inside
> blk_old_get_request() is safe. Calling blk_queue_enter_live() is only safe
> before a request queue has been marked dead. What prevents a kernel thread
> that holds a reference on a request queue and that is running concurrently
> with blk_cleanup_queue() to call blk_old_get_request() after a queue has
> been marked dead?

I have sent one delta patch in list, which will only call
blk_queue_enter_live() iff SCSI device is in QUIESCE.

-- 
Ming

Reply via email to