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 'block-5.16-2021-11-19' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:

- Flip a cap check to avoid a selinux error (Alistair)

- Fix for a regression this merge window where we can miss a queue ref
put (me)

- Un-mark pstore-blk as broken, as the condition that triggered that
change has been rectified (Kees)

- Queue quiesce and sync fixes (Ming)

- FUA insertion fix (Ming)

- blk-cgroup error path put fix (Yu)

* tag 'block-5.16-2021-11-19' of git://git.kernel.dk/linux-block:
blk-mq: don't insert FUA request with data into scheduler queue
blk-cgroup: fix missing put device in error path from blkg_conf_pref()
block: avoid to quiesce queue in elevator_init_mq
Revert "mark pstore-blk as broken"
blk-mq: cancel blk-mq dispatch work in both blk_cleanup_queue and disk_release()
block: fix missing queue put in error path
block: Check ADMIN before NICE for IOPRIO_CLASS_RT

+59 -35
+5 -4
block/blk-cgroup.c
··· 640 640 */ 641 641 ret = blk_queue_enter(q, 0); 642 642 if (ret) 643 - return ret; 643 + goto fail; 644 644 645 645 rcu_read_lock(); 646 646 spin_lock_irq(&q->queue_lock); ··· 676 676 new_blkg = blkg_alloc(pos, q, GFP_KERNEL); 677 677 if (unlikely(!new_blkg)) { 678 678 ret = -ENOMEM; 679 - goto fail; 679 + goto fail_exit_queue; 680 680 } 681 681 682 682 if (radix_tree_preload(GFP_KERNEL)) { 683 683 blkg_free(new_blkg); 684 684 ret = -ENOMEM; 685 - goto fail; 685 + goto fail_exit_queue; 686 686 } 687 687 688 688 rcu_read_lock(); ··· 722 722 fail_unlock: 723 723 spin_unlock_irq(&q->queue_lock); 724 724 rcu_read_unlock(); 725 + fail_exit_queue: 726 + blk_queue_exit(q); 725 727 fail: 726 728 blkdev_put_no_open(bdev); 727 - blk_queue_exit(q); 728 729 /* 729 730 * If queue was bypassing, we should retry. Do so after a 730 731 * short msleep(). It isn't strictly necessary but queue
+3 -1
block/blk-core.c
··· 363 363 blk_queue_flag_set(QUEUE_FLAG_DEAD, q); 364 364 365 365 blk_sync_queue(q); 366 - if (queue_is_mq(q)) 366 + if (queue_is_mq(q)) { 367 + blk_mq_cancel_work_sync(q); 367 368 blk_mq_exit_queue(q); 369 + } 368 370 369 371 /* 370 372 * In theory, request pool of sched_tags belongs to request queue.
+6 -6
block/blk-flush.c
··· 379 379 * @rq is being submitted. Analyze what needs to be done and put it on the 380 380 * right queue. 381 381 */ 382 - bool blk_insert_flush(struct request *rq) 382 + void blk_insert_flush(struct request *rq) 383 383 { 384 384 struct request_queue *q = rq->q; 385 385 unsigned long fflags = q->queue_flags; /* may change, cache */ ··· 409 409 */ 410 410 if (!policy) { 411 411 blk_mq_end_request(rq, 0); 412 - return true; 412 + return; 413 413 } 414 414 415 415 BUG_ON(rq->bio != rq->biotail); /*assumes zero or single bio rq */ ··· 420 420 * for normal execution. 421 421 */ 422 422 if ((policy & REQ_FSEQ_DATA) && 423 - !(policy & (REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH))) 424 - return false; 423 + !(policy & (REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH))) { 424 + blk_mq_request_bypass_insert(rq, false, true); 425 + return; 426 + } 425 427 426 428 /* 427 429 * @rq should go through flush machinery. Mark it part of flush ··· 439 437 spin_lock_irq(&fq->mq_flush_lock); 440 438 blk_flush_complete_seq(rq, fq, REQ_FSEQ_ACTIONS & ~policy, 0); 441 439 spin_unlock_irq(&fq->mq_flush_lock); 442 - 443 - return true; 444 440 } 445 441 446 442 /**
+24 -9
block/blk-mq.c
··· 2543 2543 return NULL; 2544 2544 } 2545 2545 2546 - static inline bool blk_mq_can_use_cached_rq(struct request *rq, 2547 - struct bio *bio) 2546 + static inline bool blk_mq_can_use_cached_rq(struct request *rq, struct bio *bio) 2548 2547 { 2549 2548 if (blk_mq_get_hctx_type(bio->bi_opf) != rq->mq_hctx->type) 2550 2549 return false; ··· 2564 2565 bool checked = false; 2565 2566 2566 2567 if (plug) { 2567 - 2568 2568 rq = rq_list_peek(&plug->cached_rq); 2569 2569 if (rq && rq->q == q) { 2570 2570 if (unlikely(!submit_bio_checks(bio))) ··· 2585 2587 fallback: 2586 2588 if (unlikely(bio_queue_enter(bio))) 2587 2589 return NULL; 2588 - if (!checked && !submit_bio_checks(bio)) 2589 - return NULL; 2590 + if (unlikely(!checked && !submit_bio_checks(bio))) 2591 + goto out_put; 2590 2592 rq = blk_mq_get_new_requests(q, plug, bio, nsegs, same_queue_rq); 2591 - if (!rq) 2592 - blk_queue_exit(q); 2593 - return rq; 2593 + if (rq) 2594 + return rq; 2595 + out_put: 2596 + blk_queue_exit(q); 2597 + return NULL; 2594 2598 } 2595 2599 2596 2600 /** ··· 2647 2647 return; 2648 2648 } 2649 2649 2650 - if (op_is_flush(bio->bi_opf) && blk_insert_flush(rq)) 2650 + if (op_is_flush(bio->bi_opf)) { 2651 + blk_insert_flush(rq); 2651 2652 return; 2653 + } 2652 2654 2653 2655 if (plug && (q->nr_hw_queues == 1 || 2654 2656 blk_mq_is_shared_tags(rq->mq_hctx->flags) || ··· 4418 4416 return rq->mq_ctx->cpu; 4419 4417 } 4420 4418 EXPORT_SYMBOL(blk_mq_rq_cpu); 4419 + 4420 + void blk_mq_cancel_work_sync(struct request_queue *q) 4421 + { 4422 + if (queue_is_mq(q)) { 4423 + struct blk_mq_hw_ctx *hctx; 4424 + int i; 4425 + 4426 + cancel_delayed_work_sync(&q->requeue_work); 4427 + 4428 + queue_for_each_hw_ctx(q, hctx, i) 4429 + cancel_delayed_work_sync(&hctx->run_work); 4430 + } 4431 + } 4421 4432 4422 4433 static int __init blk_mq_init(void) 4423 4434 {
+2
block/blk-mq.h
··· 128 128 void blk_mq_free_plug_rqs(struct blk_plug *plug); 129 129 void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule); 130 130 131 + void blk_mq_cancel_work_sync(struct request_queue *q); 132 + 131 133 void blk_mq_release(struct request_queue *q); 132 134 133 135 static inline struct blk_mq_ctx *__blk_mq_get_ctx(struct request_queue *q,
-10
block/blk-sysfs.c
··· 791 791 792 792 blk_free_queue_stats(q->stats); 793 793 794 - if (queue_is_mq(q)) { 795 - struct blk_mq_hw_ctx *hctx; 796 - int i; 797 - 798 - cancel_delayed_work_sync(&q->requeue_work); 799 - 800 - queue_for_each_hw_ctx(q, hctx, i) 801 - cancel_delayed_work_sync(&hctx->run_work); 802 - } 803 - 804 794 blk_exit_queue(q); 805 795 806 796 blk_queue_free_zone_bitmaps(q);
+1 -1
block/blk.h
··· 271 271 */ 272 272 #define ELV_ON_HASH(rq) ((rq)->rq_flags & RQF_HASHED) 273 273 274 - bool blk_insert_flush(struct request *rq); 274 + void blk_insert_flush(struct request *rq); 275 275 276 276 int elevator_switch_mq(struct request_queue *q, 277 277 struct elevator_type *new_e);
+8 -2
block/elevator.c
··· 694 694 if (!e) 695 695 return; 696 696 697 + /* 698 + * We are called before adding disk, when there isn't any FS I/O, 699 + * so freezing queue plus canceling dispatch work is enough to 700 + * drain any dispatch activities originated from passthrough 701 + * requests, then no need to quiesce queue which may add long boot 702 + * latency, especially when lots of disks are involved. 703 + */ 697 704 blk_mq_freeze_queue(q); 698 - blk_mq_quiesce_queue(q); 705 + blk_mq_cancel_work_sync(q); 699 706 700 707 err = blk_mq_init_sched(q, e); 701 708 702 - blk_mq_unquiesce_queue(q); 703 709 blk_mq_unfreeze_queue(q); 704 710 705 711 if (err) {
+2
block/genhd.c
··· 1111 1111 might_sleep(); 1112 1112 WARN_ON_ONCE(disk_live(disk)); 1113 1113 1114 + blk_mq_cancel_work_sync(disk->queue); 1115 + 1114 1116 disk_release_events(disk); 1115 1117 kfree(disk->random); 1116 1118 xa_destroy(&disk->part_tbl);
+8 -1
block/ioprio.c
··· 69 69 70 70 switch (class) { 71 71 case IOPRIO_CLASS_RT: 72 - if (!capable(CAP_SYS_NICE) && !capable(CAP_SYS_ADMIN)) 72 + /* 73 + * Originally this only checked for CAP_SYS_ADMIN, 74 + * which was implicitly allowed for pid 0 by security 75 + * modules such as SELinux. Make sure we check 76 + * CAP_SYS_ADMIN first to avoid a denial/avc for 77 + * possibly missing CAP_SYS_NICE permission. 78 + */ 79 + if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_NICE)) 73 80 return -EPERM; 74 81 fallthrough; 75 82 /* rt has prio field too */
-1
fs/pstore/Kconfig
··· 173 173 tristate "Log panic/oops to a block device" 174 174 depends on PSTORE 175 175 depends on BLOCK 176 - depends on BROKEN 177 176 select PSTORE_ZONE 178 177 default n 179 178 help