From nobody Mon Mar 27 12:54:45 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PlXpF3k8qz42Dft; Mon, 27 Mar 2023 12:54:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PlXpF35TRz3njJ; Mon, 27 Mar 2023 12:54:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679921685; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hAar9BPhvPqV5JZljdMpt7oBHYFxI6DgVkq7rQ+6uRo=; b=rtTpBlwVAPLnTAEgUqIVk6UNBU2lFPolYEALQ8U3fNWQDQxCC5Qb1j9UancPBqfW/D0orz +zpLN0PkNypwVprr3OTANiJUhdKB47O3PPx2CpuxX3uGxLH2p5FITR7ihjkTp0fzqCyc2O dFpfhGBz6WMgXBx06ob1qx+MDXXkaFA4dJYiqbp/C9BhgCGRofaI3YODCDmSKNoX9uYc0w 35PISosLOsfdejneeWikEAW2CHBdWFLkHaB7KFXT5t+1hy7lxS11eiPq4XNlvj5F+C7g5d nRaHIhTrzH5pJx+tEc0w1KHCnHrv/UssEJ2ACOVgQWlciy8JuFMgVdG75TO5ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679921685; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hAar9BPhvPqV5JZljdMpt7oBHYFxI6DgVkq7rQ+6uRo=; b=TBnRF3fz4y2H13T9xqLxhYfhdm5jRwdVvrQLTHF7kXU3MhdjH8Awbuw7R3h1FBBXoAhFd1 XBFv1xYnZDQK3eeC6wUWVGXJcCSNCsGWEHLgkFN0Aeo90QBjke98sxqs5bt2Y/y3P/sLNr ytzlIOpfFCnfANuKT/bA+9tiPUjGLxHVNrCuPs2SwDTZ1+yrZBuLIkE140rAKBUJe/42Rx SIczn+ZbohaPLdYzCVfu3CnK+x0ZVrxw3VtoZbfeDbENlnF32LXWg9YfzRy4UyR110Zznn GgxdbHFbmo66wV0myDre82SXZvM3/4RxJDb3n1/DeEw9zca5mSBPgCLhllSFXw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679921685; a=rsa-sha256; cv=none; b=KuIGRJwxUISO2vbh1V0tvz3s4xuk30insvlHhlfgjLfy04oTICIvRtuxSZ6aD+zoZOGd2X yKIQ+ISFAA/BENH2D5xsZ560VKKNygCLpKjsIF2hQl3ZZFGkhq+ZsK3Ext8Hik6mq1S7W8 acq5my7FAefBChTxcsQU/cEvW4LuMh+C0Kr3d/foflfgRZjAOSkQLIpbP+5Th6E+QNoPxp LQ4B8EJ61XofW8AERGBcPLwYG9jQB0ARxLyMFMLrA60+FVND0WZXoys+Qz3k7jZXR03rc/ HB/JN9/pa99tiMkCZ2MhElfJT6x9inLY+UD/WwKe1U0TXxxxnP3Kvm2FgUlCbQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PlXpF14pJzNSn; Mon, 27 Mar 2023 12:54:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32RCsjc2007274; Mon, 27 Mar 2023 12:54:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32RCsjJA007273; Mon, 27 Mar 2023 12:54:45 GMT (envelope-from git) Date: Mon, 27 Mar 2023 12:54:45 GMT Message-Id: <202303271254.32RCsjJA007273@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Yuri Pankov Subject: git: 6aa5b10d0c24 - main - nvme: fix resv commands with nda device List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yuripv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6aa5b10d0c245eef2410e82a02920131f65f83a3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by yuripv: URL: https://cgit.FreeBSD.org/src/commit/?id=6aa5b10d0c245eef2410e82a02920131f65f83a3 commit 6aa5b10d0c245eef2410e82a02920131f65f83a3 Author: Yuri Pankov AuthorDate: 2023-03-27 12:11:59 +0000 Commit: Yuri Pankov 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);