Skip to content

Commit c41c3ec

Browse files
committed
Merge tag 'io_uring-5.9-2020-08-23' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: - NVMe pull request from Sagi: - nvme completion rework from Christoph and Chao that mostly came from a bit of divergence of how we classify errors related to pathing/retry etc. - nvmet passthru fixes from Chaitanya - minor nvmet fixes from Amit and I - mpath round-robin path selection fix from Martin - ignore noiob for zoned devices from Keith - minor nvme-fc fix from Tianjia" - BFQ cgroup leak fix (Dmitry) - block layer MAINTAINERS addition (Geert) - fix null_blk FUA checking (Hou) - get_max_io_size() size fix (Keith) - fix block page_is_mergeable() for compound pages (Matthew) - discard granularity fixes (Ming) - IO scheduler ordering fix (Ming) - misc fixes * tag 'io_uring-5.9-2020-08-23' of git://git.kernel.dk/linux-block: (31 commits) null_blk: fix passing of REQ_FUA flag in null_handle_rq nvmet: Disable keep-alive timer when kato is cleared to 0h nvme: redirect commands on dying queue nvme: just check the status code type in nvme_is_path_error nvme: refactor command completion nvme: rename and document nvme_end_request nvme: skip noiob for zoned devices nvme-pci: fix PRP pool size nvme-pci: Use u32 for nvme_dev.q_depth and nvme_queue.q_depth nvme: Use spin_lock_irq() when taking the ctrl->lock nvmet: call blk_mq_free_request() directly nvmet: fix oops in pt cmd execution nvmet: add ns tear down label for pt-cmd handling nvme: multipath: round-robin: eliminate "fallback" variable nvme: multipath: round-robin: fix single non-optimized path case nvme-fc: Fix wrong return value in __nvme_fc_init_request() nvmet-passthru: Reject commands with non-sgl flags set nvmet: fix a memory leak blkcg: fix memleak for iolatency MAINTAINERS: Add missing header files to BLOCK LAYER section ...
2 parents 2bf7477 + 2d62e6b commit c41c3ec

26 files changed

Lines changed: 238 additions & 153 deletions

‎Documentation/fault-injection/nvme-fault-injection.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ NVMe Fault Injection
33
Linux's fault injection framework provides a systematic way to support
44
error injection via debugfs in the /sys/kernel/debug directory. When
55
enabled, the default NVME_SC_INVALID_OPCODE with no retry will be
6-
injected into the nvme_end_request. Users can change the default status
6+
injected into the nvme_try_complete_req. Users can change the default status
77
code and no retry flag via the debugfs. The list of Generic Command
88
Status can be found in include/linux/nvme.h
99

‎MAINTAINERS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3205,6 +3205,7 @@ S: Maintained
32053205
T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
32063206
F: block/
32073207
F: drivers/block/
3208+
F: include/linux/blk*
32083209
F: kernel/trace/blktrace.c
32093210
F: lib/sbitmap.c
32103211

‎block/bfq-cgroup.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ static void bfqg_put(struct bfq_group *bfqg)
332332
kfree(bfqg);
333333
}
334334

335-
void bfqg_and_blkg_get(struct bfq_group *bfqg)
335+
static void bfqg_and_blkg_get(struct bfq_group *bfqg)
336336
{
337337
/* see comments in bfq_bic_update_cgroup for why refcounting bfqg */
338338
bfqg_get(bfqg);

‎block/bfq-iosched.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,6 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd,
986986
struct blkcg_gq *bfqg_to_blkg(struct bfq_group *bfqg);
987987
struct bfq_group *bfqq_group(struct bfq_queue *bfqq);
988988
struct bfq_group *bfq_create_group_hierarchy(struct bfq_data *bfqd, int node);
989-
void bfqg_and_blkg_get(struct bfq_group *bfqg);
990989
void bfqg_and_blkg_put(struct bfq_group *bfqg);
991990

992991
#ifdef CONFIG_BFQ_GROUP_IOSCHED

‎block/bfq-wf2q.c‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,7 @@ static void bfq_get_entity(struct bfq_entity *entity)
533533
bfqq->ref++;
534534
bfq_log_bfqq(bfqq->bfqd, bfqq, "get_entity: %p %d",
535535
bfqq, bfqq->ref);
536-
} else
537-
bfqg_and_blkg_get(container_of(entity, struct bfq_group,
538-
entity));
536+
}
539537
}
540538

541539
/**
@@ -649,14 +647,8 @@ static void bfq_forget_entity(struct bfq_service_tree *st,
649647

650648
entity->on_st_or_in_serv = false;
651649
st->wsum -= entity->weight;
652-
if (is_in_service)
653-
return;
654-
655-
if (bfqq)
650+
if (bfqq && !is_in_service)
656651
bfq_put_queue(bfqq);
657-
else
658-
bfqg_and_blkg_put(container_of(entity, struct bfq_group,
659-
entity));
660652
}
661653

662654
/**

‎block/bio.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -740,8 +740,8 @@ static inline bool page_is_mergeable(const struct bio_vec *bv,
740740
struct page *page, unsigned int len, unsigned int off,
741741
bool *same_page)
742742
{
743-
phys_addr_t vec_end_addr = page_to_phys(bv->bv_page) +
744-
bv->bv_offset + bv->bv_len - 1;
743+
size_t bv_end = bv->bv_offset + bv->bv_len;
744+
phys_addr_t vec_end_addr = page_to_phys(bv->bv_page) + bv_end - 1;
745745
phys_addr_t page_addr = page_to_phys(page);
746746

747747
if (vec_end_addr + 1 != page_addr + off)
@@ -750,9 +750,9 @@ static inline bool page_is_mergeable(const struct bio_vec *bv,
750750
return false;
751751

752752
*same_page = ((vec_end_addr & PAGE_MASK) == page_addr);
753-
if (!*same_page && pfn_to_page(PFN_DOWN(vec_end_addr)) + 1 != page)
754-
return false;
755-
return true;
753+
if (*same_page)
754+
return true;
755+
return (bv->bv_page + bv_end / PAGE_SIZE) == (page + off / PAGE_SIZE);
756756
}
757757

758758
/*

‎block/blk-cgroup.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,13 +1152,15 @@ int blkcg_init_queue(struct request_queue *q)
11521152
if (preloaded)
11531153
radix_tree_preload_end();
11541154

1155-
ret = blk_iolatency_init(q);
1155+
ret = blk_throtl_init(q);
11561156
if (ret)
11571157
goto err_destroy_all;
11581158

1159-
ret = blk_throtl_init(q);
1160-
if (ret)
1159+
ret = blk_iolatency_init(q);
1160+
if (ret) {
1161+
blk_throtl_exit(q);
11611162
goto err_destroy_all;
1163+
}
11621164
return 0;
11631165

11641166
err_destroy_all:

‎block/blk-merge.c‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static inline unsigned get_max_io_size(struct request_queue *q,
154154
if (max_sectors > start_offset)
155155
return max_sectors - start_offset;
156156

157-
return sectors & (lbs - 1);
157+
return sectors & ~(lbs - 1);
158158
}
159159

160160
static inline unsigned get_max_segment_size(const struct request_queue *q,
@@ -533,10 +533,17 @@ int __blk_rq_map_sg(struct request_queue *q, struct request *rq,
533533
}
534534
EXPORT_SYMBOL(__blk_rq_map_sg);
535535

536+
static inline unsigned int blk_rq_get_max_segments(struct request *rq)
537+
{
538+
if (req_op(rq) == REQ_OP_DISCARD)
539+
return queue_max_discard_segments(rq->q);
540+
return queue_max_segments(rq->q);
541+
}
542+
536543
static inline int ll_new_hw_segment(struct request *req, struct bio *bio,
537544
unsigned int nr_phys_segs)
538545
{
539-
if (req->nr_phys_segments + nr_phys_segs > queue_max_segments(req->q))
546+
if (req->nr_phys_segments + nr_phys_segs > blk_rq_get_max_segments(req))
540547
goto no_merge;
541548

542549
if (blk_integrity_merge_bio(req->q, req, bio) == false)
@@ -624,7 +631,7 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
624631
return 0;
625632

626633
total_phys_segments = req->nr_phys_segments + next->nr_phys_segments;
627-
if (total_phys_segments > queue_max_segments(q))
634+
if (total_phys_segments > blk_rq_get_max_segments(req))
628635
return 0;
629636

630637
if (blk_integrity_merge_rq(q, req, next) == false)

‎block/blk-mq-sched.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ void blk_mq_sched_restart(struct blk_mq_hw_ctx *hctx)
7878
return;
7979
clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state);
8080

81+
/*
82+
* Order clearing SCHED_RESTART and list_empty_careful(&hctx->dispatch)
83+
* in blk_mq_run_hw_queue(). Its pair is the barrier in
84+
* blk_mq_dispatch_rq_list(). So dispatch code won't see SCHED_RESTART,
85+
* meantime new request added to hctx->dispatch is missed to check in
86+
* blk_mq_run_hw_queue().
87+
*/
88+
smp_mb();
89+
8190
blk_mq_run_hw_queue(hctx, true);
8291
}
8392

‎block/blk-mq.c‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,15 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,
14371437
list_splice_tail_init(list, &hctx->dispatch);
14381438
spin_unlock(&hctx->lock);
14391439

1440+
/*
1441+
* Order adding requests to hctx->dispatch and checking
1442+
* SCHED_RESTART flag. The pair of this smp_mb() is the one
1443+
* in blk_mq_sched_restart(). Avoid restart code path to
1444+
* miss the new added requests to hctx->dispatch, meantime
1445+
* SCHED_RESTART is observed here.
1446+
*/
1447+
smp_mb();
1448+
14401449
/*
14411450
* If SCHED_RESTART was set by the caller of this function and
14421451
* it is no longer set that means that it was cleared by another
@@ -1834,6 +1843,7 @@ void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
18341843
/**
18351844
* blk_mq_request_bypass_insert - Insert a request at dispatch list.
18361845
* @rq: Pointer to request to be inserted.
1846+
* @at_head: true if the request should be inserted at the head of the list.
18371847
* @run_queue: If we should run the hardware queue after inserting the request.
18381848
*
18391849
* Should only be used carefully, when the caller knows we want to
@@ -2016,7 +2026,8 @@ static blk_status_t __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
20162026
if (bypass_insert)
20172027
return BLK_STS_RESOURCE;
20182028

2019-
blk_mq_request_bypass_insert(rq, false, run_queue);
2029+
blk_mq_sched_insert_request(rq, false, run_queue, false);
2030+
20202031
return BLK_STS_OK;
20212032
}
20222033

0 commit comments

Comments
 (0)