Skip to content

Commit af0f446

Browse files
author
Christoph Hellwig
committed
nvme: remove nvme_update_formats
Now that the queue is frozen before updating ->lba_shift we can't hit the invalid references mentioned in the comment any more. More importantly this code would not have helped us if the format was changed by another controller or through implementation defined back channels. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
1 parent 75eb779 commit af0f446

1 file changed

Lines changed: 2 additions & 30 deletions

File tree

drivers/nvme/host/core.c

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ static dev_t nvme_chr_devt;
8989
static struct class *nvme_class;
9090
static struct class *nvme_subsys_class;
9191

92-
static int nvme_validate_ns(struct nvme_ns *ns);
9392
static void nvme_put_subsystem(struct nvme_subsystem *subsys);
9493
static void nvme_remove_invalid_namespaces(struct nvme_ctrl *ctrl,
9594
unsigned nsid);
@@ -1009,7 +1008,7 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
10091008
* For simplicity, IO to all namespaces is quiesced even if the command
10101009
* effects say only one namespace is affected.
10111010
*/
1012-
if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) {
1011+
if (effects & NVME_CMD_EFFECTS_CSE_MASK) {
10131012
mutex_lock(&ctrl->scan_lock);
10141013
mutex_lock(&ctrl->subsys->lock);
10151014
nvme_mpath_start_freeze(ctrl->subsys);
@@ -1020,36 +1019,9 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
10201019
return effects;
10211020
}
10221021

1023-
static void nvme_update_formats(struct nvme_ctrl *ctrl, u32 *effects)
1024-
{
1025-
struct nvme_ns *ns;
1026-
1027-
down_read(&ctrl->namespaces_rwsem);
1028-
list_for_each_entry(ns, &ctrl->namespaces, list)
1029-
if (nvme_validate_ns(ns))
1030-
nvme_set_queue_dying(ns);
1031-
else if (blk_queue_is_zoned(ns->disk->queue)) {
1032-
/*
1033-
* IO commands are required to fully revalidate a zoned
1034-
* device. Force the command effects to trigger rescan
1035-
* work so report zones can run in a context with
1036-
* unfrozen IO queues.
1037-
*/
1038-
*effects |= NVME_CMD_EFFECTS_NCC;
1039-
}
1040-
up_read(&ctrl->namespaces_rwsem);
1041-
}
1042-
10431022
static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects)
10441023
{
1045-
/*
1046-
* Revalidate LBA changes prior to unfreezing. This is necessary to
1047-
* prevent memory corruption if a logical block size was changed by
1048-
* this command.
1049-
*/
1050-
if (effects & NVME_CMD_EFFECTS_LBCC)
1051-
nvme_update_formats(ctrl, &effects);
1052-
if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) {
1024+
if (effects & NVME_CMD_EFFECTS_CSE_MASK) {
10531025
nvme_unfreeze(ctrl);
10541026
nvme_mpath_unfreeze(ctrl->subsys);
10551027
mutex_unlock(&ctrl->subsys->lock);

0 commit comments

Comments
 (0)