mirror of
https://github.com/torvalds/linux.git
synced 2024-12-05 02:23:16 +00:00
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>
This commit is contained in:
parent
75eb779ee0
commit
af0f446d2c
@ -89,7 +89,6 @@ static dev_t nvme_chr_devt;
|
|||||||
static struct class *nvme_class;
|
static struct class *nvme_class;
|
||||||
static struct class *nvme_subsys_class;
|
static struct class *nvme_subsys_class;
|
||||||
|
|
||||||
static int nvme_validate_ns(struct nvme_ns *ns);
|
|
||||||
static void nvme_put_subsystem(struct nvme_subsystem *subsys);
|
static void nvme_put_subsystem(struct nvme_subsystem *subsys);
|
||||||
static void nvme_remove_invalid_namespaces(struct nvme_ctrl *ctrl,
|
static void nvme_remove_invalid_namespaces(struct nvme_ctrl *ctrl,
|
||||||
unsigned nsid);
|
unsigned nsid);
|
||||||
@ -1009,7 +1008,7 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
|
|||||||
* For simplicity, IO to all namespaces is quiesced even if the command
|
* For simplicity, IO to all namespaces is quiesced even if the command
|
||||||
* effects say only one namespace is affected.
|
* effects say only one namespace is affected.
|
||||||
*/
|
*/
|
||||||
if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) {
|
if (effects & NVME_CMD_EFFECTS_CSE_MASK) {
|
||||||
mutex_lock(&ctrl->scan_lock);
|
mutex_lock(&ctrl->scan_lock);
|
||||||
mutex_lock(&ctrl->subsys->lock);
|
mutex_lock(&ctrl->subsys->lock);
|
||||||
nvme_mpath_start_freeze(ctrl->subsys);
|
nvme_mpath_start_freeze(ctrl->subsys);
|
||||||
@ -1020,36 +1019,9 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
|
|||||||
return effects;
|
return effects;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nvme_update_formats(struct nvme_ctrl *ctrl, u32 *effects)
|
|
||||||
{
|
|
||||||
struct nvme_ns *ns;
|
|
||||||
|
|
||||||
down_read(&ctrl->namespaces_rwsem);
|
|
||||||
list_for_each_entry(ns, &ctrl->namespaces, list)
|
|
||||||
if (nvme_validate_ns(ns))
|
|
||||||
nvme_set_queue_dying(ns);
|
|
||||||
else if (blk_queue_is_zoned(ns->disk->queue)) {
|
|
||||||
/*
|
|
||||||
* IO commands are required to fully revalidate a zoned
|
|
||||||
* device. Force the command effects to trigger rescan
|
|
||||||
* work so report zones can run in a context with
|
|
||||||
* unfrozen IO queues.
|
|
||||||
*/
|
|
||||||
*effects |= NVME_CMD_EFFECTS_NCC;
|
|
||||||
}
|
|
||||||
up_read(&ctrl->namespaces_rwsem);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects)
|
static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects)
|
||||||
{
|
{
|
||||||
/*
|
if (effects & NVME_CMD_EFFECTS_CSE_MASK) {
|
||||||
* Revalidate LBA changes prior to unfreezing. This is necessary to
|
|
||||||
* prevent memory corruption if a logical block size was changed by
|
|
||||||
* this command.
|
|
||||||
*/
|
|
||||||
if (effects & NVME_CMD_EFFECTS_LBCC)
|
|
||||||
nvme_update_formats(ctrl, &effects);
|
|
||||||
if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) {
|
|
||||||
nvme_unfreeze(ctrl);
|
nvme_unfreeze(ctrl);
|
||||||
nvme_mpath_unfreeze(ctrl->subsys);
|
nvme_mpath_unfreeze(ctrl->subsys);
|
||||||
mutex_unlock(&ctrl->subsys->lock);
|
mutex_unlock(&ctrl->subsys->lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user