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
This commit is contained in:
parent
1249680609
commit
6aa5b10d0c
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user