summaryrefslogtreecommitdiffstats
path: root/drivers/nvme/host/fabrics.h
diff options
context:
space:
mode:
authorKeith Busch <kbusch@kernel.org>2024-01-24 18:27:27 +0100
committerKeith Busch <kbusch@kernel.org>2024-01-29 16:02:50 +0100
commit6d3c7fb17b4c047ccd0b42cf1308da693ab45acb (patch)
treee219029aeb82327159efc5a90f0de9a30a35993b /drivers/nvme/host/fabrics.h
parentnvmet-tcp: fix nvme tcp ida memory leak (diff)
downloadlinux-6d3c7fb17b4c047ccd0b42cf1308da693ab45acb.tar.xz
linux-6d3c7fb17b4c047ccd0b42cf1308da693ab45acb.zip
nvme: use ctrl state accessor
The ctrl->state value is updated in another thread using WRITE_ONCE, so ensure all the readers use the appropriate accessor. Reviewed-by: Sagi Grimberg <sagi@grmberg.me> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'drivers/nvme/host/fabrics.h')
-rw-r--r--drivers/nvme/host/fabrics.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h
index fbaee5a7be19..06cc54851b1b 100644
--- a/drivers/nvme/host/fabrics.h
+++ b/drivers/nvme/host/fabrics.h
@@ -185,9 +185,11 @@ static inline bool
nvmf_ctlr_matches_baseopts(struct nvme_ctrl *ctrl,
struct nvmf_ctrl_options *opts)
{
- if (ctrl->state == NVME_CTRL_DELETING ||
- ctrl->state == NVME_CTRL_DELETING_NOIO ||
- ctrl->state == NVME_CTRL_DEAD ||
+ enum nvme_ctrl_state state = nvme_ctrl_state(ctrl);
+
+ if (state == NVME_CTRL_DELETING ||
+ state == NVME_CTRL_DELETING_NOIO ||
+ state == NVME_CTRL_DEAD ||
strcmp(opts->subsysnqn, ctrl->opts->subsysnqn) ||
strcmp(opts->host->nqn, ctrl->opts->host->nqn) ||
!uuid_equal(&opts->host->id, &ctrl->opts->host->id))