Merge tag 'block-5.14-2021-07-24' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:

- NVMe pull request (Christoph):
- tracing fix (Keith Busch)
- fix multipath head refcounting (Hannes Reinecke)
- Write Zeroes vs PI fix (me)
- drop a bogus WARN_ON (Zhihao Cheng)

- Increase max blk-cgroup policy size, now that mq-deadline
uses it too (Oleksandr)

* tag 'block-5.14-2021-07-24' of git://git.kernel.dk/linux-block:
nvme: set the PRACT bit when using Write Zeroes with T10 PI
nvme: fix nvme_setup_command metadata trace event
nvme: fix refcounting imbalance when all paths are down
nvme-pci: don't WARN_ON in nvme_reset_work if ctrl.state is not RESETTING
block: increase BLKCG_MAX_POLS

+32 -19
+15 -4
drivers/nvme/host/core.c
··· 900 900 cpu_to_le64(nvme_sect_to_lba(ns, blk_rq_pos(req))); 901 901 cmnd->write_zeroes.length = 902 902 cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1); 903 - cmnd->write_zeroes.control = 0; 903 + if (nvme_ns_has_pi(ns)) 904 + cmnd->write_zeroes.control = cpu_to_le16(NVME_RW_PRINFO_PRACT); 905 + else 906 + cmnd->write_zeroes.control = 0; 904 907 return BLK_STS_OK; 905 908 } 906 909 ··· 3810 3807 3811 3808 static void nvme_ns_remove(struct nvme_ns *ns) 3812 3809 { 3810 + bool last_path = false; 3811 + 3813 3812 if (test_and_set_bit(NVME_NS_REMOVING, &ns->flags)) 3814 3813 return; 3815 3814 ··· 3820 3815 3821 3816 mutex_lock(&ns->ctrl->subsys->lock); 3822 3817 list_del_rcu(&ns->siblings); 3823 - if (list_empty(&ns->head->list)) 3824 - list_del_init(&ns->head->entry); 3825 3818 mutex_unlock(&ns->ctrl->subsys->lock); 3826 3819 3827 3820 synchronize_rcu(); /* guarantee not available in head->list */ ··· 3839 3836 list_del_init(&ns->list); 3840 3837 up_write(&ns->ctrl->namespaces_rwsem); 3841 3838 3842 - nvme_mpath_check_last_path(ns); 3839 + /* Synchronize with nvme_init_ns_head() */ 3840 + mutex_lock(&ns->head->subsys->lock); 3841 + if (list_empty(&ns->head->list)) { 3842 + list_del_init(&ns->head->entry); 3843 + last_path = true; 3844 + } 3845 + mutex_unlock(&ns->head->subsys->lock); 3846 + if (last_path) 3847 + nvme_mpath_shutdown_disk(ns->head); 3843 3848 nvme_put_ns(ns); 3844 3849 } 3845 3850
+8 -1
drivers/nvme/host/multipath.c
··· 760 760 #endif 761 761 } 762 762 763 - void nvme_mpath_remove_disk(struct nvme_ns_head *head) 763 + void nvme_mpath_shutdown_disk(struct nvme_ns_head *head) 764 764 { 765 765 if (!head->disk) 766 766 return; 767 + kblockd_schedule_work(&head->requeue_work); 767 768 if (head->disk->flags & GENHD_FL_UP) { 768 769 nvme_cdev_del(&head->cdev, &head->cdev_device); 769 770 del_gendisk(head->disk); 770 771 } 772 + } 773 + 774 + void nvme_mpath_remove_disk(struct nvme_ns_head *head) 775 + { 776 + if (!head->disk) 777 + return; 771 778 blk_set_queue_dying(head->disk->queue); 772 779 /* make sure all pending bios are cleaned up */ 773 780 kblockd_schedule_work(&head->requeue_work);
+2 -9
drivers/nvme/host/nvme.h
··· 716 716 void nvme_mpath_stop(struct nvme_ctrl *ctrl); 717 717 bool nvme_mpath_clear_current_path(struct nvme_ns *ns); 718 718 void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl); 719 - 720 - static inline void nvme_mpath_check_last_path(struct nvme_ns *ns) 721 - { 722 - struct nvme_ns_head *head = ns->head; 723 - 724 - if (head->disk && list_empty(&head->list)) 725 - kblockd_schedule_work(&head->requeue_work); 726 - } 719 + void nvme_mpath_shutdown_disk(struct nvme_ns_head *head); 727 720 728 721 static inline void nvme_trace_bio_complete(struct request *req) 729 722 { ··· 765 772 static inline void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl) 766 773 { 767 774 } 768 - static inline void nvme_mpath_check_last_path(struct nvme_ns *ns) 775 + static inline void nvme_mpath_shutdown_disk(struct nvme_ns_head *head) 769 776 { 770 777 } 771 778 static inline void nvme_trace_bio_complete(struct request *req)
+3 -1
drivers/nvme/host/pci.c
··· 2631 2631 bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL); 2632 2632 int result; 2633 2633 2634 - if (WARN_ON(dev->ctrl.state != NVME_CTRL_RESETTING)) { 2634 + if (dev->ctrl.state != NVME_CTRL_RESETTING) { 2635 + dev_warn(dev->ctrl.device, "ctrl state %d is not RESETTING\n", 2636 + dev->ctrl.state); 2635 2637 result = -ENODEV; 2636 2638 goto out; 2637 2639 }
+3 -3
drivers/nvme/host/trace.h
··· 56 56 __field(u8, fctype) 57 57 __field(u16, cid) 58 58 __field(u32, nsid) 59 - __field(u64, metadata) 59 + __field(bool, metadata) 60 60 __array(u8, cdw10, 24) 61 61 ), 62 62 TP_fast_assign( ··· 66 66 __entry->flags = cmd->common.flags; 67 67 __entry->cid = cmd->common.command_id; 68 68 __entry->nsid = le32_to_cpu(cmd->common.nsid); 69 - __entry->metadata = le64_to_cpu(cmd->common.metadata); 69 + __entry->metadata = !!blk_integrity_rq(req); 70 70 __entry->fctype = cmd->fabrics.fctype; 71 71 __assign_disk_name(__entry->disk, req->rq_disk); 72 72 memcpy(__entry->cdw10, &cmd->common.cdw10, 73 73 sizeof(__entry->cdw10)); 74 74 ), 75 - TP_printk("nvme%d: %sqid=%d, cmdid=%u, nsid=%u, flags=0x%x, meta=0x%llx, cmd=(%s %s)", 75 + TP_printk("nvme%d: %sqid=%d, cmdid=%u, nsid=%u, flags=0x%x, meta=0x%x, cmd=(%s %s)", 76 76 __entry->ctrl_id, __print_disk_name(__entry->disk), 77 77 __entry->qid, __entry->cid, __entry->nsid, 78 78 __entry->flags, __entry->metadata,
+1 -1
include/linux/blkdev.h
··· 57 57 * Maximum number of blkcg policies allowed to be registered concurrently. 58 58 * Defined here to simplify include dependency. 59 59 */ 60 - #define BLKCG_MAX_POLS 5 60 + #define BLKCG_MAX_POLS 6 61 61 62 62 typedef void (rq_end_io_fn)(struct request *, blk_status_t); 63 63