From nobody Wed Sep 06 20:40:33 2023 X-Original-To: dev-commits-src-all@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 4RgvQT6F4Zz4snxt; Wed, 6 Sep 2023 20:40:33 +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 4RgvQT4qNXz4ccw; Wed, 6 Sep 2023 20:40:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694032833; 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=bkHpv0Fe1muLquKvelq3zByt0jpw0v7nyzaW661eL+E=; b=fuxcgSzxryS0e20RvXUTpbtP6245xKhjz7rXsyRQ3OdoJ8CFUnoyd/q0eIt2CLZQt8z2Oz JaiZpxsmM6bC/OjLf/WT4o/qkaWtLJRZHUmdjR1Kvq1EXmO803lMosqYXuDkjvS7/JqaAu tPTiMIkGbvxfjdkOfHFWn4ElrCYaxyYbu10RhzzNxCd7059z3OCXJocW0Bbi8Kvwwdj4s6 laGwVf4ACyVUP4wRo3vntoFIFND/ummFmbkIoW7W7/WzYVaLOxT2FRqwgKgDbfO55zqMO6 0Sexo9EH4kg14L4r8To7nirUXFF051yWYWvsmVzFZ+GDbB0PTva+ZVc1Z/momw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694032833; a=rsa-sha256; cv=none; b=pn5DFMDweEOl9dP0+Rl+RwB95mSt2p4whfS4SzL9qWSHoe2gilcD1uU07kJopnpNeyLpul NhY9M0ZuEit51MiQF5d3yg6nmkLnKPlaOYjaDVKU7dN4kzJJAadDn5J9AAKUtJ9Hkwio5i RYMBD7NRhFXDYoe4aKPHTp8HCWvbH8j10XEzJZ01zJiPerjL3TOzQbo9nnYH/e30EHKo3i VoSFJttA9/XT3JYtvo7zJvL3ZUuYle5SI7RgCNaXuN4rWLZpaPj1XUpawbzlKZ9CgMOSos ej2oT8/XCrsJ29g95qZa4DMm7LTfGeHDLVxA+AMdZJS/RqqEb3UidDA8IaMhKw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694032833; 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=bkHpv0Fe1muLquKvelq3zByt0jpw0v7nyzaW661eL+E=; b=L15isfKQ2gU+jXcGJQiwbrKpGRmrGm7MIEfqXkygPIOS0HYGpj+MqTTC2tY1mmOtNgDQNI i2rPe5A0wCcNvkZjKPy86DUoHqPn5lqs0ndffUVG1hOh7qrPnxTYwZW16BJTINcyeVV8vC D1fAa9yPZ0P0mTkJW0DePiTDxhRpwnTOKB4IobTxur7YR3rrSHRJIebgyf7VpyggPX4f5s 5/sfHnwiutHgyNOKF7gtka7NnC7+/s4OAQ5yKr0lhC1Mx4OPvf4x4Pxjkim2CnUgJRZ62k lQJ3kyAR3ah+5OP6Q0m0vgFGPxvzMYCHXbhjh5FESQrWJsMK7rRmlH1PZ9hVPg== 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 4RgvQT3nSSzX3G; Wed, 6 Sep 2023 20:40:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 386KeXGa094355; Wed, 6 Sep 2023 20:40:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 386KeXHK094352; Wed, 6 Sep 2023 20:40:33 GMT (envelope-from git) Date: Wed, 6 Sep 2023 20:40:33 GMT Message-Id: <202309062040.386KeXHK094352@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: a6506dda739c - stable/13 - sesutil: fix "fault all" with zoned jbods List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a6506dda739c04186e7fe966687200cc74d36091 Auto-Submitted: auto-generated The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=a6506dda739c04186e7fe966687200cc74d36091 commit a6506dda739c04186e7fe966687200cc74d36091 Author: Alan Somers AuthorDate: 2023-03-10 17:47:08 +0000 Commit: Alan Somers CommitDate: 2023-09-06 20:39:35 +0000 sesutil: fix "fault all" with zoned jbods Some SAS JBODs support zoning. This feature allows individual SAS targets to be accessible by only some initiator ports. One application would be connecting two servers to the same JBOD, but they wouldn't be able to see each other's disks. A zoned JBOD should also prohibit initiators from accessing SES elements corresponding to inaccessible SAS targets. It reports that by setting the element's status code to 0x8 (No Access Allowed). The bug is that when doing "sesutil (fault|locate) all ...", sesutil will attempt a ENCIOC_SETELMSTAT ioctl for every single element, even the inaccessible ones. The enclosure will reject the command, the kernel will return EINVAL, and sesutil will exit. The solution is to check the element's status, and skip trying to set it if the status is 0x8. But if the user actually supplied a ses ID, then assume that he knows what he's doing and try to set it anyway. PR: 270093 Sponsored by: Axcient Reviewed by: mav, trasz Differential Revision: https://reviews.freebsd.org/D39017 (cherry picked from commit 57dc6f5e200b10d34ccb97ccc18d06b3f0b9b933) --- usr.sbin/sesutil/sesutil.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/usr.sbin/sesutil/sesutil.c b/usr.sbin/sesutil/sesutil.c index 99f6b2de63b0..863b95a0f8b0 100644 --- a/usr.sbin/sesutil/sesutil.c +++ b/usr.sbin/sesutil/sesutil.c @@ -279,6 +279,16 @@ sesled(int argc, char **argv, bool setfault) char devnames[devnames_size]; if (all) { + encioc_elm_status_t es; + memset(&es, 0, sizeof(es)); + es.elm_idx = objp[j].elm_idx; + if (ioctl(fd, ENCIOC_GETELMSTAT, &es) < 0) { + close(fd); + xo_err(EXIT_FAILURE, + "ENCIOC_GETELMSTAT"); + } + if ((es.cstat[0] & 0xf) == SES_OBJSTAT_NOACCESS) + continue; do_led(fd, objp[j].elm_idx, objp[j].elm_type, onoff, setfault); continue;