Skip to content

Commit 9a15c94

Browse files
committed
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
2 parents 8a21d9f + 7f32890 commit 9a15c94

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

block/blk-core.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -693,20 +693,11 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
693693
if (!uninit_q)
694694
return NULL;
695695

696-
uninit_q->flush_rq = kzalloc(sizeof(struct request), GFP_KERNEL);
697-
if (!uninit_q->flush_rq)
698-
goto out_cleanup_queue;
699-
700696
q = blk_init_allocated_queue(uninit_q, rfn, lock);
701697
if (!q)
702-
goto out_free_flush_rq;
703-
return q;
698+
blk_cleanup_queue(uninit_q);
704699

705-
out_free_flush_rq:
706-
kfree(uninit_q->flush_rq);
707-
out_cleanup_queue:
708-
blk_cleanup_queue(uninit_q);
709-
return NULL;
700+
return q;
710701
}
711702
EXPORT_SYMBOL(blk_init_queue_node);
712703

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

711+
q->flush_rq = kzalloc(sizeof(struct request), GFP_KERNEL);
712+
if (!q->flush_rq)
713+
return NULL;
714+
720715
if (blk_init_rl(&q->root_rl, q, GFP_KERNEL))
721716
return NULL;
722717

block/blk-flush.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,17 @@ static void mq_flush_run(struct work_struct *work)
140140
blk_mq_insert_request(rq, false, true, false);
141141
}
142142

143-
static bool blk_flush_queue_rq(struct request *rq)
143+
static bool blk_flush_queue_rq(struct request *rq, bool add_front)
144144
{
145145
if (rq->q->mq_ops) {
146146
INIT_WORK(&rq->mq_flush_work, mq_flush_run);
147147
kblockd_schedule_work(rq->q, &rq->mq_flush_work);
148148
return false;
149149
} else {
150-
list_add_tail(&rq->queuelist, &rq->q->queue_head);
150+
if (add_front)
151+
list_add(&rq->queuelist, &rq->q->queue_head);
152+
else
153+
list_add_tail(&rq->queuelist, &rq->q->queue_head);
151154
return true;
152155
}
153156
}
@@ -193,7 +196,7 @@ static bool blk_flush_complete_seq(struct request *rq, unsigned int seq,
193196

194197
case REQ_FSEQ_DATA:
195198
list_move_tail(&rq->flush.list, &q->flush_data_in_flight);
196-
queued = blk_flush_queue_rq(rq);
199+
queued = blk_flush_queue_rq(rq, true);
197200
break;
198201

199202
case REQ_FSEQ_DONE:
@@ -326,7 +329,7 @@ static bool blk_kick_flush(struct request_queue *q)
326329
q->flush_rq->rq_disk = first_rq->rq_disk;
327330
q->flush_rq->end_io = flush_end_io;
328331

329-
return blk_flush_queue_rq(q->flush_rq);
332+
return blk_flush_queue_rq(q->flush_rq, false);
330333
}
331334

332335
static void flush_data_end_io(struct request *rq, int error)

drivers/block/mtip32xx/mtip32xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4498,7 +4498,7 @@ static int mtip_pci_probe(struct pci_dev *pdev,
44984498
}
44994499
dev_info(&pdev->dev, "NUMA node %d (closest: %d,%d, probe on %d:%d)\n",
45004500
my_node, pcibus_to_node(pdev->bus), dev_to_node(&pdev->dev),
4501-
cpu_to_node(smp_processor_id()), smp_processor_id());
4501+
cpu_to_node(raw_smp_processor_id()), raw_smp_processor_id());
45024502

45034503
dd = kzalloc_node(sizeof(struct driver_data), GFP_KERNEL, my_node);
45044504
if (dd == NULL) {

0 commit comments

Comments
 (0)