aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-03-17 16:54:49 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2014-03-17 16:54:49 -0700
commit9a15c944f76cffa5581959cefe709c7c4ea26994 (patch)
treed09480aafdb5c41ee5f1f53346ec1eb6e1717bd8
parent8a21d9f63dd47485964b930af41304d88dee0e9b (diff)
parent7f328908f9cb69a72ce1c9279508c786cf85f1f5 (diff)
downloadxen-9a15c944f76cffa5581959cefe709c7c4ea26994.tar.gz
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
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
-rw-r--r--block/blk-core.c17
-rw-r--r--block/blk-flush.c11
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c2
3 files changed, 14 insertions, 16 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 853f92749202cb..4cd5ffc184427c 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -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);
@@ -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;
diff --git a/block/blk-flush.c b/block/blk-flush.c
index f598f794c3c679..43e6b4755e9a7e 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -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;
}
}
@@ -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:
@@ -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)
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 516026954be62d..d777bb7cea93fd 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -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) {