Skip to content

Commit 4d4a60c

Browse files
committed
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
2 parents 0823bae + 7054133 commit 4d4a60c

File tree

6 files changed

+32
-19
lines changed

6 files changed

+32
-19
lines changed

drivers/nvme/host/core.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,10 @@ static inline blk_status_t nvme_setup_write_zeroes(struct nvme_ns *ns,
900900
cpu_to_le64(nvme_sect_to_lba(ns, blk_rq_pos(req)));
901901
cmnd->write_zeroes.length =
902902
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;
904907
return BLK_STS_OK;
905908
}
906909

@@ -3807,6 +3810,8 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,
38073810

38083811
static void nvme_ns_remove(struct nvme_ns *ns)
38093812
{
3813+
bool last_path = false;
3814+
38103815
if (test_and_set_bit(NVME_NS_REMOVING, &ns->flags))
38113816
return;
38123817

@@ -3815,8 +3820,6 @@ static void nvme_ns_remove(struct nvme_ns *ns)
38153820

38163821
mutex_lock(&ns->ctrl->subsys->lock);
38173822
list_del_rcu(&ns->siblings);
3818-
if (list_empty(&ns->head->list))
3819-
list_del_init(&ns->head->entry);
38203823
mutex_unlock(&ns->ctrl->subsys->lock);
38213824

38223825
synchronize_rcu(); /* guarantee not available in head->list */
@@ -3836,7 +3839,15 @@ static void nvme_ns_remove(struct nvme_ns *ns)
38363839
list_del_init(&ns->list);
38373840
up_write(&ns->ctrl->namespaces_rwsem);
38383841

3839-
nvme_mpath_check_last_path(ns);
3842+
/* Synchronize with nvme_init_ns_head() */
3843+
mutex_lock(&ns->head->subsys->lock);
3844+
if (list_empty(&ns->head->list)) {
3845+
list_del_init(&ns->head->entry);
3846+
last_path = true;
3847+
}
3848+
mutex_unlock(&ns->head->subsys->lock);
3849+
if (last_path)
3850+
nvme_mpath_shutdown_disk(ns->head);
38403851
nvme_put_ns(ns);
38413852
}
38423853

drivers/nvme/host/multipath.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,14 +760,21 @@ void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id)
760760
#endif
761761
}
762762

763-
void nvme_mpath_remove_disk(struct nvme_ns_head *head)
763+
void nvme_mpath_shutdown_disk(struct nvme_ns_head *head)
764764
{
765765
if (!head->disk)
766766
return;
767+
kblockd_schedule_work(&head->requeue_work);
767768
if (head->disk->flags & GENHD_FL_UP) {
768769
nvme_cdev_del(&head->cdev, &head->cdev_device);
769770
del_gendisk(head->disk);
770771
}
772+
}
773+
774+
void nvme_mpath_remove_disk(struct nvme_ns_head *head)
775+
{
776+
if (!head->disk)
777+
return;
771778
blk_set_queue_dying(head->disk->queue);
772779
/* make sure all pending bios are cleaned up */
773780
kblockd_schedule_work(&head->requeue_work);

drivers/nvme/host/nvme.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -716,14 +716,7 @@ void nvme_mpath_uninit(struct nvme_ctrl *ctrl);
716716
void nvme_mpath_stop(struct nvme_ctrl *ctrl);
717717
bool nvme_mpath_clear_current_path(struct nvme_ns *ns);
718718
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);
727720

728721
static inline void nvme_trace_bio_complete(struct request *req)
729722
{
@@ -772,7 +765,7 @@ static inline bool nvme_mpath_clear_current_path(struct nvme_ns *ns)
772765
static inline void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl)
773766
{
774767
}
775-
static inline void nvme_mpath_check_last_path(struct nvme_ns *ns)
768+
static inline void nvme_mpath_shutdown_disk(struct nvme_ns_head *head)
776769
{
777770
}
778771
static inline void nvme_trace_bio_complete(struct request *req)

drivers/nvme/host/pci.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2631,7 +2631,9 @@ static void nvme_reset_work(struct work_struct *work)
26312631
bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL);
26322632
int result;
26332633

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);
26352637
result = -ENODEV;
26362638
goto out;
26372639
}

drivers/nvme/host/trace.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ TRACE_EVENT(nvme_setup_cmd,
5656
__field(u8, fctype)
5757
__field(u16, cid)
5858
__field(u32, nsid)
59-
__field(u64, metadata)
59+
__field(bool, metadata)
6060
__array(u8, cdw10, 24)
6161
),
6262
TP_fast_assign(
@@ -66,13 +66,13 @@ TRACE_EVENT(nvme_setup_cmd,
6666
__entry->flags = cmd->common.flags;
6767
__entry->cid = cmd->common.command_id;
6868
__entry->nsid = le32_to_cpu(cmd->common.nsid);
69-
__entry->metadata = le64_to_cpu(cmd->common.metadata);
69+
__entry->metadata = !!blk_integrity_rq(req);
7070
__entry->fctype = cmd->fabrics.fctype;
7171
__assign_disk_name(__entry->disk, req->rq_disk);
7272
memcpy(__entry->cdw10, &cmd->common.cdw10,
7373
sizeof(__entry->cdw10));
7474
),
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)",
7676
__entry->ctrl_id, __print_disk_name(__entry->disk),
7777
__entry->qid, __entry->cid, __entry->nsid,
7878
__entry->flags, __entry->metadata,

include/linux/blkdev.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct blk_keyslot_manager;
5757
* Maximum number of blkcg policies allowed to be registered concurrently.
5858
* Defined here to simplify include dependency.
5959
*/
60-
#define BLKCG_MAX_POLS 5
60+
#define BLKCG_MAX_POLS 6
6161

6262
typedef void (rq_end_io_fn)(struct request *, blk_status_t);
6363

0 commit comments

Comments
 (0)