Skip to content

Commit d218a8a

Browse files
sagigrimbergChristoph Hellwig
authored andcommitted
nvmet: don't check iosqes,iocqes for discovery controllers
From the base spec, Figure 78: "Controller Configuration, these fields are defined as parameters to configure an "I/O Controller (IOC)" and not to configure a "Discovery Controller (DC). ... If the controller does not support I/O queues, then this field shall be read-only with a value of 0h Just perform this check for I/O controllers. Fixes: a07b497 ("nvmet: add a generic NVMe target") Reported-by: Belanger, Martin <[email protected]> Signed-off-by: Sagi Grimberg <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent c4c6df5 commit d218a8a

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

drivers/nvme/target/core.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,9 +1118,20 @@ static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl)
11181118
{
11191119
lockdep_assert_held(&ctrl->lock);
11201120

1121-
if (nvmet_cc_iosqes(ctrl->cc) != NVME_NVM_IOSQES ||
1122-
nvmet_cc_iocqes(ctrl->cc) != NVME_NVM_IOCQES ||
1123-
nvmet_cc_mps(ctrl->cc) != 0 ||
1121+
/*
1122+
* Only I/O controllers should verify iosqes,iocqes.
1123+
* Strictly speaking, the spec says a discovery controller
1124+
* should verify iosqes,iocqes are zeroed, however that
1125+
* would break backwards compatibility, so don't enforce it.
1126+
*/
1127+
if (ctrl->subsys->type != NVME_NQN_DISC &&
1128+
(nvmet_cc_iosqes(ctrl->cc) != NVME_NVM_IOSQES ||
1129+
nvmet_cc_iocqes(ctrl->cc) != NVME_NVM_IOCQES)) {
1130+
ctrl->csts = NVME_CSTS_CFS;
1131+
return;
1132+
}
1133+
1134+
if (nvmet_cc_mps(ctrl->cc) != 0 ||
11241135
nvmet_cc_ams(ctrl->cc) != 0 ||
11251136
nvmet_cc_css(ctrl->cc) != 0) {
11261137
ctrl->csts = NVME_CSTS_CFS;

0 commit comments

Comments
 (0)