git: 6aa5b10d0c24 - main - nvme: fix resv commands with nda device
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 27 Mar 2023 12:54:45 UTC
The branch main has been updated by yuripv:
URL: https://cgit.FreeBSD.org/src/commit/?id=6aa5b10d0c245eef2410e82a02920131f65f83a3
commit 6aa5b10d0c245eef2410e82a02920131f65f83a3
Author: Yuri Pankov <yuripv@FreeBSD.org>
AuthorDate: 2023-03-27 12:11:59 +0000
Commit: Yuri Pankov <yuripv@FreeBSD.org>
CommitDate: 2023-03-27 12:53:24 +0000
nvme: fix resv commands with nda device
- passing I/O commands through nda requires nsid field to be set (it was
unused when going through nvme_ns_ioctl())
- ccb's status can be OR'ed with the flags, use CAM_STATUS_MASK
Reviewed by: imp (cam)
Differential Revision: https://reviews.freebsd.org/D37696
---
sbin/nvmecontrol/resv.c | 4 ++++
sys/cam/nvme/nvme_da.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/sbin/nvmecontrol/resv.c b/sbin/nvmecontrol/resv.c
index adb3b64c9ec3..8649c0da8a91 100644
--- a/sbin/nvmecontrol/resv.c
+++ b/sbin/nvmecontrol/resv.c
@@ -255,6 +255,7 @@ resvacquire(const struct cmd *f, int argc, char *argv[])
memset(&pt, 0, sizeof(pt));
pt.cmd.opc = NVME_OPC_RESERVATION_ACQUIRE;
+ pt.cmd.nsid = htole32(nsid);
pt.cmd.cdw10 = htole32((acquire_opt.racqa & 7) |
(acquire_opt.rtype << 8));
pt.buf = &data;
@@ -293,6 +294,7 @@ resvregister(const struct cmd *f, int argc, char *argv[])
memset(&pt, 0, sizeof(pt));
pt.cmd.opc = NVME_OPC_RESERVATION_REGISTER;
+ pt.cmd.nsid = htole32(nsid);
pt.cmd.cdw10 = htole32((register_opt.rrega & 7) |
(register_opt.iekey << 3) | (register_opt.cptpl << 30));
pt.buf = &data;
@@ -330,6 +332,7 @@ resvrelease(const struct cmd *f, int argc, char *argv[])
memset(&pt, 0, sizeof(pt));
pt.cmd.opc = NVME_OPC_RESERVATION_RELEASE;
+ pt.cmd.nsid = htole32(nsid);
pt.cmd.cdw10 = htole32((release_opt.rrela & 7) |
(release_opt.rtype << 8));
pt.buf = &data;
@@ -369,6 +372,7 @@ resvreport(const struct cmd *f, int argc, char *argv[])
bzero(data, sizeof(data));
memset(&pt, 0, sizeof(pt));
pt.cmd.opc = NVME_OPC_RESERVATION_REPORT;
+ pt.cmd.nsid = htole32(nsid);
pt.cmd.cdw10 = htole32(sizeof(data) / 4 - 1);
pt.cmd.cdw11 = htole32(report_opt.eds); /* EDS */
pt.buf = &data;
diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c
index 3e37abe0f6e4..51689d0e4a23 100644
--- a/sys/cam/nvme/nvme_da.c
+++ b/sys/cam/nvme/nvme_da.c
@@ -441,7 +441,8 @@ ndaioctl(struct disk *dp, u_long cmd, void *data, int fflag,
*/
cam_periph_unlock(periph);
cam_periph_unmapmem(ccb, &mapinfo);
- error = (ccb->ccb_h.status == CAM_REQ_CMP) ? 0 : EIO;
+ error = (ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP ?
+ 0 : EIO;
out:
cam_periph_lock(periph);
xpt_release_ccb(ccb);