Skip to content
  • Jeff Moyer's avatar
    cfq-iosched: fix incorrect filing of rt async cfqq · 8a9a6a13
    Jeff Moyer authored
    commit c6ce194325cef342313e3d27620411ce90a89c50 upstream.
    
    Hi,
    
    If you can manage to submit an async write as the first async I/O from
    the context of a process with realtime scheduling priority, then a
    cfq_queue is allocated, but filed into the wrong async_cfqq bucket.  It
    ends up in the best effort array, but actually has realtime I/O
    scheduling priority set in cfqq->ioprio.
    
    The reason is that cfq_get_queue assumes the default scheduling class and
    priority when there is no information present (i.e. when the async cfqq
    is created):
    
    static struct cfq_queue *
    cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct cfq_io_cq *cic,
    	      struct bio *bio, gfp_t gfp_mask)
    {
    	const int ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio);
    	const int ioprio = IOPRIO_PRIO_DATA(cic->ioprio);
    
    cic->ioprio starts out as 0, which is "invalid".  So, class of 0
    (IOPRIO_CLASS_NONE) is passed to cfq_async_queue_prio like so:
    
    		async_cfqq = cfq_async_queue_prio(cfqd, ioprio...
    8a9a6a13