Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus-20180629' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:
"Small set of fixes for this series. Mostly just minor fixes, the only
oddball in here is the sg change.

The sg change came out of the stall fix for NVMe, where we added a
mempool and limited us to a single page allocation. CONFIG_SG_DEBUG
sort-of ruins that, since we'd need to account for that. That's
actually a generic problem, since lots of drivers need to allocate SG
lists. So this just removes support for CONFIG_SG_DEBUG, which I added
back in 2007 and to my knowledge it was never useful.

Anyway, outside of that, this pull contains:

- clone of request with special payload fix (Bart)

- drbd discard handling fix (Bart)

- SATA blk-mq stall fix (me)

- chunk size fix (Keith)

- double free nvme rdma fix (Sagi)"

* tag 'for-linus-20180629' of git://git.kernel.dk/linux-block:
sg: remove ->sg_magic member
drbd: Fix drbd_request_prepare() discard handling
blk-mq: don't queue more if we get a busy return
block: Fix cloning of requests with a special payload
nvme-rdma: fix possible double free of controller async event buffer
block: Fix transfer when chunk sectors exceeds max

+25 -51
+4
block/blk-core.c
··· 3473 3473 dst->cpu = src->cpu; 3474 3474 dst->__sector = blk_rq_pos(src); 3475 3475 dst->__data_len = blk_rq_bytes(src); 3476 + if (src->rq_flags & RQF_SPECIAL_PAYLOAD) { 3477 + dst->rq_flags |= RQF_SPECIAL_PAYLOAD; 3478 + dst->special_vec = src->special_vec; 3479 + } 3476 3480 dst->nr_phys_segments = src->nr_phys_segments; 3477 3481 dst->ioprio = src->ioprio; 3478 3482 dst->extra_len = src->extra_len;
+12
block/blk-mq.c
··· 1075 1075 1076 1076 #define BLK_MQ_RESOURCE_DELAY 3 /* ms units */ 1077 1077 1078 + /* 1079 + * Returns true if we did some work AND can potentially do more. 1080 + */ 1078 1081 bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list, 1079 1082 bool got_budget) 1080 1083 { ··· 1208 1205 blk_mq_run_hw_queue(hctx, true); 1209 1206 else if (needs_restart && (ret == BLK_STS_RESOURCE)) 1210 1207 blk_mq_delay_run_hw_queue(hctx, BLK_MQ_RESOURCE_DELAY); 1208 + 1209 + return false; 1211 1210 } 1211 + 1212 + /* 1213 + * If the host/device is unable to accept more work, inform the 1214 + * caller of that. 1215 + */ 1216 + if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE) 1217 + return false; 1212 1218 1213 1219 return (queued + errors) != 0; 1214 1220 }
+2 -2
drivers/block/drbd/drbd_req.c
··· 1244 1244 _drbd_start_io_acct(device, req); 1245 1245 1246 1246 /* process discards always from our submitter thread */ 1247 - if ((bio_op(bio) & REQ_OP_WRITE_ZEROES) || 1248 - (bio_op(bio) & REQ_OP_DISCARD)) 1247 + if (bio_op(bio) == REQ_OP_WRITE_ZEROES || 1248 + bio_op(bio) == REQ_OP_DISCARD) 1249 1249 goto queue_for_submitter_thread; 1250 1250 1251 1251 if (rw == WRITE && req->private_bio && req->i.size
-3
drivers/gpu/drm/i915/i915_drv.h
··· 2245 2245 **/ 2246 2246 static inline struct scatterlist *__sg_next(struct scatterlist *sg) 2247 2247 { 2248 - #ifdef CONFIG_DEBUG_SG 2249 - BUG_ON(sg->sg_magic != SG_MAGIC); 2250 - #endif 2251 2248 return sg_is_last(sg) ? NULL : ____sg_next(sg); 2252 2249 } 2253 2250
+5 -2
drivers/nvme/host/rdma.c
··· 732 732 blk_cleanup_queue(ctrl->ctrl.admin_q); 733 733 nvme_rdma_free_tagset(&ctrl->ctrl, ctrl->ctrl.admin_tagset); 734 734 } 735 - nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe, 736 - sizeof(struct nvme_command), DMA_TO_DEVICE); 735 + if (ctrl->async_event_sqe.data) { 736 + nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe, 737 + sizeof(struct nvme_command), DMA_TO_DEVICE); 738 + ctrl->async_event_sqe.data = NULL; 739 + } 737 740 nvme_rdma_free_queue(&ctrl->queues[0]); 738 741 } 739 742
+2 -2
include/linux/blkdev.h
··· 1119 1119 if (!q->limits.chunk_sectors) 1120 1120 return q->limits.max_sectors; 1121 1121 1122 - return q->limits.chunk_sectors - 1123 - (offset & (q->limits.chunk_sectors - 1)); 1122 + return min(q->limits.max_sectors, (unsigned int)(q->limits.chunk_sectors - 1123 + (offset & (q->limits.chunk_sectors - 1)))); 1124 1124 } 1125 1125 1126 1126 static inline unsigned int blk_rq_get_max_sectors(struct request *rq,
-18
include/linux/scatterlist.h
··· 9 9 #include <asm/io.h> 10 10 11 11 struct scatterlist { 12 - #ifdef CONFIG_DEBUG_SG 13 - unsigned long sg_magic; 14 - #endif 15 12 unsigned long page_link; 16 13 unsigned int offset; 17 14 unsigned int length; ··· 61 64 * 62 65 */ 63 66 64 - #define SG_MAGIC 0x87654321 65 67 #define SG_CHAIN 0x01UL 66 68 #define SG_END 0x02UL 67 69 ··· 94 98 */ 95 99 BUG_ON((unsigned long) page & (SG_CHAIN | SG_END)); 96 100 #ifdef CONFIG_DEBUG_SG 97 - BUG_ON(sg->sg_magic != SG_MAGIC); 98 101 BUG_ON(sg_is_chain(sg)); 99 102 #endif 100 103 sg->page_link = page_link | (unsigned long) page; ··· 124 129 static inline struct page *sg_page(struct scatterlist *sg) 125 130 { 126 131 #ifdef CONFIG_DEBUG_SG 127 - BUG_ON(sg->sg_magic != SG_MAGIC); 128 132 BUG_ON(sg_is_chain(sg)); 129 133 #endif 130 134 return (struct page *)((sg)->page_link & ~(SG_CHAIN | SG_END)); ··· 189 195 **/ 190 196 static inline void sg_mark_end(struct scatterlist *sg) 191 197 { 192 - #ifdef CONFIG_DEBUG_SG 193 - BUG_ON(sg->sg_magic != SG_MAGIC); 194 - #endif 195 198 /* 196 199 * Set termination bit, clear potential chain bit 197 200 */ ··· 206 215 **/ 207 216 static inline void sg_unmark_end(struct scatterlist *sg) 208 217 { 209 - #ifdef CONFIG_DEBUG_SG 210 - BUG_ON(sg->sg_magic != SG_MAGIC); 211 - #endif 212 218 sg->page_link &= ~SG_END; 213 219 } 214 220 ··· 248 260 static inline void sg_init_marker(struct scatterlist *sgl, 249 261 unsigned int nents) 250 262 { 251 - #ifdef CONFIG_DEBUG_SG 252 - unsigned int i; 253 - 254 - for (i = 0; i < nents; i++) 255 - sgl[i].sg_magic = SG_MAGIC; 256 - #endif 257 263 sg_mark_end(&sgl[nents - 1]); 258 264 } 259 265
-6
lib/scatterlist.c
··· 24 24 **/ 25 25 struct scatterlist *sg_next(struct scatterlist *sg) 26 26 { 27 - #ifdef CONFIG_DEBUG_SG 28 - BUG_ON(sg->sg_magic != SG_MAGIC); 29 - #endif 30 27 if (sg_is_last(sg)) 31 28 return NULL; 32 29 ··· 108 111 for_each_sg(sgl, sg, nents, i) 109 112 ret = sg; 110 113 111 - #ifdef CONFIG_DEBUG_SG 112 - BUG_ON(sgl[0].sg_magic != SG_MAGIC); 113 114 BUG_ON(!sg_is_last(ret)); 114 - #endif 115 115 return ret; 116 116 } 117 117 EXPORT_SYMBOL(sg_last);
-18
tools/virtio/linux/scatterlist.h
··· 36 36 */ 37 37 BUG_ON((unsigned long) page & 0x03); 38 38 #ifdef CONFIG_DEBUG_SG 39 - BUG_ON(sg->sg_magic != SG_MAGIC); 40 39 BUG_ON(sg_is_chain(sg)); 41 40 #endif 42 41 sg->page_link = page_link | (unsigned long) page; ··· 66 67 static inline struct page *sg_page(struct scatterlist *sg) 67 68 { 68 69 #ifdef CONFIG_DEBUG_SG 69 - BUG_ON(sg->sg_magic != SG_MAGIC); 70 70 BUG_ON(sg_is_chain(sg)); 71 71 #endif 72 72 return (struct page *)((sg)->page_link & ~0x3); ··· 114 116 **/ 115 117 static inline void sg_mark_end(struct scatterlist *sg) 116 118 { 117 - #ifdef CONFIG_DEBUG_SG 118 - BUG_ON(sg->sg_magic != SG_MAGIC); 119 - #endif 120 119 /* 121 120 * Set termination bit, clear potential chain bit 122 121 */ ··· 131 136 **/ 132 137 static inline void sg_unmark_end(struct scatterlist *sg) 133 138 { 134 - #ifdef CONFIG_DEBUG_SG 135 - BUG_ON(sg->sg_magic != SG_MAGIC); 136 - #endif 137 139 sg->page_link &= ~0x02; 138 140 } 139 141 140 142 static inline struct scatterlist *sg_next(struct scatterlist *sg) 141 143 { 142 - #ifdef CONFIG_DEBUG_SG 143 - BUG_ON(sg->sg_magic != SG_MAGIC); 144 - #endif 145 144 if (sg_is_last(sg)) 146 145 return NULL; 147 146 ··· 149 160 static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents) 150 161 { 151 162 memset(sgl, 0, sizeof(*sgl) * nents); 152 - #ifdef CONFIG_DEBUG_SG 153 - { 154 - unsigned int i; 155 - for (i = 0; i < nents; i++) 156 - sgl[i].sg_magic = SG_MAGIC; 157 - } 158 - #endif 159 163 sg_mark_end(&sgl[nents - 1]); 160 164 } 161 165