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