Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
Browse files Browse the repository at this point in the history
Pull final final block IO fixes from Jens Axboe:
 "Yes, the last round was final. This one is final final.

  The mtip32xx fix could have waited, but it's so simple and gets rid of
  two warning spewages on load.  The two block flush fixes are critical
  for blk-mq, and are the primary reason for this late pull request"

* 'for-linus' of git://git.kernel.dk/linux-block:
  mtip32xx: fix bad use of smp_processor_id()
  block: change flush sequence list addition back to front add
  block: fix q->flush_rq NULL pointer crash on dm-mpath flush
  • Loading branch information
Linus Torvalds committed Mar 17, 2014
2 parents 8a21d9f + 7f32890 commit 9a15c94
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
17 changes: 6 additions & 11 deletions block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,20 +693,11 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
if (!uninit_q)
return NULL;

uninit_q->flush_rq = kzalloc(sizeof(struct request), GFP_KERNEL);
if (!uninit_q->flush_rq)
goto out_cleanup_queue;

q = blk_init_allocated_queue(uninit_q, rfn, lock);
if (!q)
goto out_free_flush_rq;
return q;
blk_cleanup_queue(uninit_q);

out_free_flush_rq:
kfree(uninit_q->flush_rq);
out_cleanup_queue:
blk_cleanup_queue(uninit_q);
return NULL;
return q;
}
EXPORT_SYMBOL(blk_init_queue_node);

Expand All @@ -717,6 +708,10 @@ blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn,
if (!q)
return NULL;

q->flush_rq = kzalloc(sizeof(struct request), GFP_KERNEL);
if (!q->flush_rq)
return NULL;

if (blk_init_rl(&q->root_rl, q, GFP_KERNEL))
return NULL;

Expand Down
11 changes: 7 additions & 4 deletions block/blk-flush.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,17 @@ static void mq_flush_run(struct work_struct *work)
blk_mq_insert_request(rq, false, true, false);
}

static bool blk_flush_queue_rq(struct request *rq)
static bool blk_flush_queue_rq(struct request *rq, bool add_front)
{
if (rq->q->mq_ops) {
INIT_WORK(&rq->mq_flush_work, mq_flush_run);
kblockd_schedule_work(rq->q, &rq->mq_flush_work);
return false;
} else {
list_add_tail(&rq->queuelist, &rq->q->queue_head);
if (add_front)
list_add(&rq->queuelist, &rq->q->queue_head);
else
list_add_tail(&rq->queuelist, &rq->q->queue_head);
return true;
}
}
Expand Down Expand Up @@ -193,7 +196,7 @@ static bool blk_flush_complete_seq(struct request *rq, unsigned int seq,

case REQ_FSEQ_DATA:
list_move_tail(&rq->flush.list, &q->flush_data_in_flight);
queued = blk_flush_queue_rq(rq);
queued = blk_flush_queue_rq(rq, true);
break;

case REQ_FSEQ_DONE:
Expand Down Expand Up @@ -326,7 +329,7 @@ static bool blk_kick_flush(struct request_queue *q)
q->flush_rq->rq_disk = first_rq->rq_disk;
q->flush_rq->end_io = flush_end_io;

return blk_flush_queue_rq(q->flush_rq);
return blk_flush_queue_rq(q->flush_rq, false);
}

static void flush_data_end_io(struct request *rq, int error)
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/mtip32xx/mtip32xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -4498,7 +4498,7 @@ static int mtip_pci_probe(struct pci_dev *pdev,
}
dev_info(&pdev->dev, "NUMA node %d (closest: %d,%d, probe on %d:%d)\n",
my_node, pcibus_to_node(pdev->bus), dev_to_node(&pdev->dev),
cpu_to_node(smp_processor_id()), smp_processor_id());
cpu_to_node(raw_smp_processor_id()), raw_smp_processor_id());

dd = kzalloc_node(sizeof(struct driver_data), GFP_KERNEL, my_node);
if (dd == NULL) {
Expand Down

0 comments on commit 9a15c94

Please sign in to comment.