Skip to content

Commit 5ab25a3

Browse files
sagigrimbergChristoph Hellwig
authored andcommitted
nvme: don't intialize hwmon for discovery controllers
Discovery controllers usually don't support smart log page command. So when we connect to the discovery controller we see this warning: nvme nvme0: Failed to read smart log (error 24577) nvme nvme0: new ctrl: NQN "nqn.2014-08.org.nvmexpress.discovery", addr 192.168.123.1:8009 nvme nvme0: Removing ctrl: NQN "nqn.2014-08.org.nvmexpress.discovery" Introduce a new helper to understand if the controller is a discovery controller and use this helper to skip nvme_init_hwmon (also use it in other places that we check if the controller is a discovery controller). Fixes: 400b6a7 ("nvme: Add hardware monitoring support") Signed-off-by: Sagi Grimberg <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent ca1ff67 commit 5ab25a3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/nvme/host/core.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2856,6 +2856,11 @@ static const struct attribute_group *nvme_subsys_attrs_groups[] = {
28562856
NULL,
28572857
};
28582858

2859+
static inline bool nvme_discovery_ctrl(struct nvme_ctrl *ctrl)
2860+
{
2861+
return ctrl->opts && ctrl->opts->discovery_nqn;
2862+
}
2863+
28592864
static bool nvme_validate_cntlid(struct nvme_subsystem *subsys,
28602865
struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
28612866
{
@@ -2875,7 +2880,7 @@ static bool nvme_validate_cntlid(struct nvme_subsystem *subsys,
28752880
}
28762881

28772882
if ((id->cmic & NVME_CTRL_CMIC_MULTI_CTRL) ||
2878-
(ctrl->opts && ctrl->opts->discovery_nqn))
2883+
nvme_discovery_ctrl(ctrl))
28792884
continue;
28802885

28812886
dev_err(ctrl->device,
@@ -3144,7 +3149,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
31443149
goto out_free;
31453150
}
31463151

3147-
if (!ctrl->opts->discovery_nqn && !ctrl->kas) {
3152+
if (!nvme_discovery_ctrl(ctrl) && !ctrl->kas) {
31483153
dev_err(ctrl->device,
31493154
"keep-alive support is mandatory for fabrics\n");
31503155
ret = -EINVAL;
@@ -3184,7 +3189,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
31843189
if (ret < 0)
31853190
return ret;
31863191

3187-
if (!ctrl->identified) {
3192+
if (!ctrl->identified && !nvme_discovery_ctrl(ctrl)) {
31883193
ret = nvme_hwmon_init(ctrl);
31893194
if (ret < 0)
31903195
return ret;

0 commit comments

Comments
 (0)