Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178291108
D61554.1796444557.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D61554.1796444557.diff
View Options
diff --git a/tools/tools/nvmf/nvmfd/ctl.c b/tools/tools/nvmf/nvmfd/ctl.c
--- a/tools/tools/nvmf/nvmfd/ctl.c
+++ b/tools/tools/nvmf/nvmfd/ctl.c
@@ -116,7 +116,7 @@
nvlist_destroy(nvl);
}
-void
+bool
ctl_handoff_qpair(struct nvmf_qpair *qp,
const struct nvmf_fabric_connect_cmd *cmd,
const struct nvmf_fabric_connect_data *data)
@@ -129,9 +129,20 @@
error = nvmf_handoff_controller_qpair(qp, cmd, data, &req.data.handoff);
if (error != 0) {
warnc(error, "Failed to prepare qpair for handoff");
- return;
+ return (false);
}
- if (ioctl(ctl_fd, CTL_NVMF, &req) != 0)
+ if (ioctl(ctl_fd, CTL_NVMF, &req) != 0) {
warn("ioctl(CTL_NVMF/CTL_NVMF_HANDOFF)");
+ return (false);
+ }
+ if (req.status == CTL_NVMF_ERROR) {
+ warnx("Failed to handoff NVMF connection: %s", req.error_str);
+ return (false);
+ } else if (req.status != CTL_NVMF_OK) {
+ warnx("Failed to handoff NVMF connection with status %d",
+ req.status);
+ return (false);
+ }
+ return (true);
}
diff --git a/tools/tools/nvmf/nvmfd/internal.h b/tools/tools/nvmf/nvmfd/internal.h
--- a/tools/tools/nvmf/nvmfd/internal.h
+++ b/tools/tools/nvmf/nvmfd/internal.h
@@ -58,7 +58,7 @@
/* ctl.c */
void init_ctl_port(const char *subnqn,
const struct nvmf_association_params *params);
-void ctl_handoff_qpair(struct nvmf_qpair *qp,
+bool ctl_handoff_qpair(struct nvmf_qpair *qp,
const struct nvmf_fabric_connect_cmd *cmd,
const struct nvmf_fabric_connect_data *data);
void shutdown_ctl_port(const char *subnqn);
diff --git a/tools/tools/nvmf/nvmfd/io.c b/tools/tools/nvmf/nvmfd/io.c
--- a/tools/tools/nvmf/nvmfd/io.c
+++ b/tools/tools/nvmf/nvmfd/io.c
@@ -615,19 +615,21 @@
goto error;
}
- if (kernel_io) {
- ctl_handoff_qpair(qp, nvmf_capsule_sqe(nc), &data);
- goto error;
- }
-
if (strcmp(data.subnqn, nqn) != 0) {
- warn("I/O qpair with invalid SubNQN: %.*s",
+ warnx("I/O qpair with invalid SubNQN: %.*s",
(int)sizeof(data.subnqn), data.subnqn);
nvmf_connect_invalid_parameters(nc, true,
offsetof(struct nvmf_fabric_connect_data, subnqn));
goto error;
}
+ if (kernel_io) {
+ if (!ctl_handoff_qpair(qp, nvmf_capsule_sqe(nc), &data))
+ nvmf_connect_generic_error(nc,
+ NVME_SC_INTERNAL_DEVICE_ERROR);
+ goto error;
+ }
+
/* Is this an admin or I/O queue pair? */
cmd = nvmf_capsule_sqe(nc);
if (cmd->qid == 0)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 5, 4:22 AM (5 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42218859
Default Alt Text
D61554.1796444557.diff (2 KB)
Attached To
Mode
D61554: nvmfd: Always return a CQE with a suitable error if kernel handoff fails
Attached
Detach File
Event Timeline