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 branch 'for-linus' of git://git.kernel.dk/linux-block

Pull block layer fixes from Jens Axboe:
"A smaller collection of fixes that have come up since the initial
merge window pull request. This contains:

- error handling cleanup and support for larger than 16 byte cdbs in
sg_io() from Christoph. The latter just matches what bsg and
friends support, sg_io() got left out in the merge.

- an option for brd to expose partitions in /proc/partitions. They
are hidden by default for compat reasons. From Dmitry Monakhov.

- a few blk-mq fixes from me - killing a dead/unused flag, fix for
merging happening even if turned off, and correction of a few
comments.

- removal of unnecessary ->owner setting in systemace. From Michal
Simek.

- two related fixes for a problem with nesting freezing of queues in
blk-mq. One from Ming Lei removing an unecessary freeze operation,
and another from Tejun fixing the nesting regression introduced in
the merge window.

- fix for a BUG_ON() at bio_endio time when protection info is
attached and the IO has an error. From Sagi Grimberg.

- two scsi_ioctl bug fixes for regressions with scsi-mq from Tony
Battersby.

- a cfq weight update fix and subsequent comment update from Toshiaki
Makita"

* 'for-linus' of git://git.kernel.dk/linux-block:
cfq-iosched: Add comments on update timing of weight
cfq-iosched: Fix wrong children_weight calculation
block: fix error handling in sg_io
fix regression in SCSI_IOCTL_SEND_COMMAND
scsi-mq: fix requests that use a separate CDB buffer
block: support > 16 byte CDBs for SG_IO
block: cleanup error handling in sg_io
brd: add ram disk visibility option
block: systemace: Remove .owner field for driver
blk-mq: blk_mq_freeze_queue() should allow nesting
blk-mq: correct a few wrong/bad comments
block: Fix BUG_ON when pi errors occur
blk-mq: don't allow merges if turned off for the queue
blk-mq: get rid of unused BLK_MQ_F_SHOULD_SORT flag
blk-mq: fix WARNING "percpu_ref_kill() called more than once!"

+74 -39
+1 -1
block/bio-integrity.c
··· 520 520 */ 521 521 if (error) { 522 522 bio->bi_end_io = bip->bip_end_io; 523 - bio_endio(bio, error); 523 + bio_endio_nodec(bio, error); 524 524 525 525 return; 526 526 }
-1
block/blk-core.c
··· 1252 1252 rq->__sector = (sector_t) -1; 1253 1253 rq->bio = rq->biotail = NULL; 1254 1254 memset(rq->__cmd, 0, sizeof(rq->__cmd)); 1255 - rq->cmd = rq->__cmd; 1256 1255 } 1257 1256 EXPORT_SYMBOL(blk_rq_set_block_pc); 1258 1257
+22 -14
block/blk-mq.c
··· 112 112 */ 113 113 void blk_mq_freeze_queue(struct request_queue *q) 114 114 { 115 + bool freeze; 116 + 115 117 spin_lock_irq(q->queue_lock); 116 - q->mq_freeze_depth++; 118 + freeze = !q->mq_freeze_depth++; 117 119 spin_unlock_irq(q->queue_lock); 118 120 119 - percpu_ref_kill(&q->mq_usage_counter); 120 - blk_mq_run_queues(q, false); 121 + if (freeze) { 122 + percpu_ref_kill(&q->mq_usage_counter); 123 + blk_mq_run_queues(q, false); 124 + } 121 125 wait_event(q->mq_freeze_wq, percpu_ref_is_zero(&q->mq_usage_counter)); 122 126 } 123 127 124 128 static void blk_mq_unfreeze_queue(struct request_queue *q) 125 129 { 126 - bool wake = false; 130 + bool wake; 127 131 128 132 spin_lock_irq(q->queue_lock); 129 133 wake = !--q->mq_freeze_depth; ··· 175 171 rq->special = NULL; 176 172 /* tag was already set */ 177 173 rq->errors = 0; 174 + 175 + rq->cmd = rq->__cmd; 178 176 179 177 rq->extra_len = 0; 180 178 rq->sense_len = 0; ··· 1074 1068 blk_account_io_start(rq, 1); 1075 1069 } 1076 1070 1071 + static inline bool hctx_allow_merges(struct blk_mq_hw_ctx *hctx) 1072 + { 1073 + return (hctx->flags & BLK_MQ_F_SHOULD_MERGE) && 1074 + !blk_queue_nomerges(hctx->queue); 1075 + } 1076 + 1077 1077 static inline bool blk_mq_merge_queue_io(struct blk_mq_hw_ctx *hctx, 1078 1078 struct blk_mq_ctx *ctx, 1079 1079 struct request *rq, struct bio *bio) 1080 1080 { 1081 - struct request_queue *q = hctx->queue; 1082 - 1083 - if (!(hctx->flags & BLK_MQ_F_SHOULD_MERGE)) { 1081 + if (!hctx_allow_merges(hctx)) { 1084 1082 blk_mq_bio_to_request(rq, bio); 1085 1083 spin_lock(&ctx->lock); 1086 1084 insert_rq: ··· 1092 1082 spin_unlock(&ctx->lock); 1093 1083 return false; 1094 1084 } else { 1085 + struct request_queue *q = hctx->queue; 1086 + 1095 1087 spin_lock(&ctx->lock); 1096 1088 if (!blk_mq_attempt_merge(q, ctx, bio)) { 1097 1089 blk_mq_bio_to_request(rq, bio); ··· 1586 1574 hctx->tags = set->tags[i]; 1587 1575 1588 1576 /* 1589 - * Allocate space for all possible cpus to avoid allocation in 1577 + * Allocate space for all possible cpus to avoid allocation at 1590 1578 * runtime 1591 1579 */ 1592 1580 hctx->ctxs = kmalloc_node(nr_cpu_ids * sizeof(void *), ··· 1674 1662 1675 1663 queue_for_each_hw_ctx(q, hctx, i) { 1676 1664 /* 1677 - * If not software queues are mapped to this hardware queue, 1678 - * disable it and free the request entries 1665 + * If no software queues are mapped to this hardware queue, 1666 + * disable it and free the request entries. 1679 1667 */ 1680 1668 if (!hctx->nr_ctx) { 1681 1669 struct blk_mq_tag_set *set = q->tag_set; ··· 1725 1713 { 1726 1714 struct blk_mq_tag_set *set = q->tag_set; 1727 1715 1728 - blk_mq_freeze_queue(q); 1729 - 1730 1716 mutex_lock(&set->tag_list_lock); 1731 1717 list_del_init(&q->tag_set_list); 1732 1718 blk_mq_update_tag_set_depth(set); 1733 1719 mutex_unlock(&set->tag_list_lock); 1734 - 1735 - blk_mq_unfreeze_queue(q); 1736 1720 } 1737 1721 1738 1722 static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set,
+16 -3
block/cfq-iosched.c
··· 1272 1272 rb_insert_color(&cfqg->rb_node, &st->rb); 1273 1273 } 1274 1274 1275 + /* 1276 + * This has to be called only on activation of cfqg 1277 + */ 1275 1278 static void 1276 1279 cfq_update_group_weight(struct cfq_group *cfqg) 1277 1280 { 1278 - BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node)); 1279 - 1280 1281 if (cfqg->new_weight) { 1281 1282 cfqg->weight = cfqg->new_weight; 1282 1283 cfqg->new_weight = 0; 1283 1284 } 1285 + } 1286 + 1287 + static void 1288 + cfq_update_group_leaf_weight(struct cfq_group *cfqg) 1289 + { 1290 + BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node)); 1284 1291 1285 1292 if (cfqg->new_leaf_weight) { 1286 1293 cfqg->leaf_weight = cfqg->new_leaf_weight; ··· 1306 1299 /* add to the service tree */ 1307 1300 BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node)); 1308 1301 1309 - cfq_update_group_weight(cfqg); 1302 + /* 1303 + * Update leaf_weight. We cannot update weight at this point 1304 + * because cfqg might already have been activated and is 1305 + * contributing its current weight to the parent's child_weight. 1306 + */ 1307 + cfq_update_group_leaf_weight(cfqg); 1310 1308 __cfq_group_service_tree_add(st, cfqg); 1311 1309 1312 1310 /* ··· 1335 1323 */ 1336 1324 while ((parent = cfqg_parent(pos))) { 1337 1325 if (propagate) { 1326 + cfq_update_group_weight(pos); 1338 1327 propagate = !parent->nr_active++; 1339 1328 parent->children_weight += pos->weight; 1340 1329 }
+27 -13
block/scsi_ioctl.c
··· 279 279 r = blk_rq_unmap_user(bio); 280 280 if (!ret) 281 281 ret = r; 282 - blk_put_request(rq); 283 282 284 283 return ret; 285 284 } ··· 295 296 struct bio *bio; 296 297 297 298 if (hdr->interface_id != 'S') 298 - return -EINVAL; 299 - if (hdr->cmd_len > BLK_MAX_CDB) 300 299 return -EINVAL; 301 300 302 301 if (hdr->dxfer_len > (queue_max_hw_sectors(q) << 9)) ··· 314 317 if (hdr->flags & SG_FLAG_Q_AT_HEAD) 315 318 at_head = 1; 316 319 320 + ret = -ENOMEM; 317 321 rq = blk_get_request(q, writing ? WRITE : READ, GFP_KERNEL); 318 322 if (!rq) 319 - return -ENOMEM; 323 + goto out; 320 324 blk_rq_set_block_pc(rq); 321 325 322 - if (blk_fill_sghdr_rq(q, rq, hdr, mode)) { 323 - blk_put_request(rq); 324 - return -EFAULT; 326 + if (hdr->cmd_len > BLK_MAX_CDB) { 327 + rq->cmd = kzalloc(hdr->cmd_len, GFP_KERNEL); 328 + if (!rq->cmd) 329 + goto out_put_request; 325 330 } 326 331 332 + ret = -EFAULT; 333 + if (blk_fill_sghdr_rq(q, rq, hdr, mode)) 334 + goto out_free_cdb; 335 + 336 + ret = 0; 327 337 if (hdr->iovec_count) { 328 338 size_t iov_data_len; 329 339 struct iovec *iov = NULL; ··· 339 335 0, NULL, &iov); 340 336 if (ret < 0) { 341 337 kfree(iov); 342 - goto out; 338 + goto out_free_cdb; 343 339 } 344 340 345 341 iov_data_len = ret; ··· 362 358 GFP_KERNEL); 363 359 364 360 if (ret) 365 - goto out; 361 + goto out_free_cdb; 366 362 367 363 bio = rq->bio; 368 364 memset(sense, 0, sizeof(sense)); ··· 380 376 381 377 hdr->duration = jiffies_to_msecs(jiffies - start_time); 382 378 383 - return blk_complete_sghdr_rq(rq, hdr, bio); 384 - out: 379 + ret = blk_complete_sghdr_rq(rq, hdr, bio); 380 + 381 + out_free_cdb: 382 + if (rq->cmd != rq->__cmd) 383 + kfree(rq->cmd); 384 + out_put_request: 385 385 blk_put_request(rq); 386 + out: 386 387 return ret; 387 388 } 388 389 ··· 457 448 } 458 449 459 450 rq = blk_get_request(q, in_len ? WRITE : READ, __GFP_WAIT); 451 + if (!rq) { 452 + err = -ENOMEM; 453 + goto error; 454 + } 455 + blk_rq_set_block_pc(rq); 460 456 461 457 cmdlen = COMMAND_SIZE(opcode); 462 458 ··· 515 501 memset(sense, 0, sizeof(sense)); 516 502 rq->sense = sense; 517 503 rq->sense_len = 0; 518 - blk_rq_set_block_pc(rq); 519 504 520 505 blk_execute_rq(q, disk, rq, 0); 521 506 ··· 534 521 535 522 error: 536 523 kfree(buffer); 537 - blk_put_request(rq); 524 + if (rq) 525 + blk_put_request(rq); 538 526 return err; 539 527 } 540 528 EXPORT_SYMBOL_GPL(sg_scsi_ioctl);
+5 -1
drivers/block/brd.c
··· 442 442 int rd_size = CONFIG_BLK_DEV_RAM_SIZE; 443 443 static int max_part; 444 444 static int part_shift; 445 + static int part_show = 0; 445 446 module_param(rd_nr, int, S_IRUGO); 446 447 MODULE_PARM_DESC(rd_nr, "Maximum number of brd devices"); 447 448 module_param(rd_size, int, S_IRUGO); 448 449 MODULE_PARM_DESC(rd_size, "Size of each RAM disk in kbytes."); 449 450 module_param(max_part, int, S_IRUGO); 450 451 MODULE_PARM_DESC(max_part, "Maximum number of partitions per RAM disk"); 452 + module_param(part_show, int, S_IRUGO); 453 + MODULE_PARM_DESC(part_show, "Control RAM disk visibility in /proc/partitions"); 451 454 MODULE_LICENSE("GPL"); 452 455 MODULE_ALIAS_BLOCKDEV_MAJOR(RAMDISK_MAJOR); 453 456 MODULE_ALIAS("rd"); ··· 504 501 disk->fops = &brd_fops; 505 502 disk->private_data = brd; 506 503 disk->queue = brd->brd_queue; 507 - disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; 504 + if (!part_show) 505 + disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; 508 506 sprintf(disk->disk_name, "ram%d", i); 509 507 set_capacity(disk, rd_size * 2); 510 508
-1
drivers/block/xsysace.c
··· 1203 1203 .probe = ace_probe, 1204 1204 .remove = ace_remove, 1205 1205 .driver = { 1206 - .owner = THIS_MODULE, 1207 1206 .name = "xsysace", 1208 1207 .of_match_table = ace_of_match, 1209 1208 },
-1
drivers/scsi/scsi_lib.c
··· 1808 1808 1809 1809 cmd->tag = req->tag; 1810 1810 1811 - req->cmd = req->__cmd; 1812 1811 cmd->cmnd = req->cmd; 1813 1812 cmd->prot_op = SCSI_PROT_NORMAL; 1814 1813
+3 -4
include/linux/blk-mq.h
··· 127 127 BLK_MQ_RQ_QUEUE_ERROR = 2, /* end IO with error */ 128 128 129 129 BLK_MQ_F_SHOULD_MERGE = 1 << 0, 130 - BLK_MQ_F_SHOULD_SORT = 1 << 1, 131 - BLK_MQ_F_TAG_SHARED = 1 << 2, 132 - BLK_MQ_F_SG_MERGE = 1 << 3, 133 - BLK_MQ_F_SYSFS_UP = 1 << 4, 130 + BLK_MQ_F_TAG_SHARED = 1 << 1, 131 + BLK_MQ_F_SG_MERGE = 1 << 2, 132 + BLK_MQ_F_SYSFS_UP = 1 << 3, 134 133 135 134 BLK_MQ_S_STOPPED = 0, 136 135 BLK_MQ_S_TAG_ACTIVE = 1,