Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 08D2D85B93 for ; Thu, 26 Oct 2023 15:13:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id cR6SEIikZkzF for ; Thu, 26 Oct 2023 15:13:38 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id 86F408501A for ; Thu, 26 Oct 2023 15:13:38 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 81526FADC; Thu, 26 Oct 2023 15:13:38 +0000 (UTC) Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" MIME-Version: 1.0 Date: Thu, 26 Oct 2023 15:13:38 +0000 From: "Martin Husemann" Subject: CVS commit: [netbsd-8] src/sys/dev/pci To: source-changes@NetBSD.org Approved: for-source-only Reply-To: martin@netbsd.org X-Mailer: log_accum Message-Id: <20231026151338.81526FADC@cvs.NetBSD.org> Module Name: src Committed By: martin Date: Thu Oct 26 15:13:38 UTC 2023 Modified Files: src/sys/dev/pci [netbsd-8]: mpii.c Log Message: Pull up following revision(s) (requested by buhrow in ticket #1916): sys/dev/pci/mpii.c: revision 1.30 Fixes for PR kern/57133: I can now explain why this assert is firing and have a fix for it. It is a regression introduced in R1.22 of mpii.c. If a request comes in and the IOC returns a MPII_SCSIIO_STATUS_CHECK_COND condition, after a successful transfer, or one that is a recovered error, mpii(4) correctly sets the xs->error to XS_SENSE, but incorrectly sets xs->resid to 0 before returning the xfer to the upper scsi layers. Once the upper layers get it, they notice the XS_SENSE check condition and because it's a retryable error, they increment xs_requeuecnt, set ERESTART and send the xfer request down to the mpii(4) layer again for a retry. What they do not do is reset xs->resid equal to xs->datalen. When the xfer comes down to mpii(4) again, the assert happens. The fix is for the mpii(4) driver to leave xs->resid alone when it encounters a MPII_SCSIIO_STATUS_CHECK_COND condition. This bug affects NetBSD-10, netbsd-9 and netbsd-8. To generate a diff of this commit: cvs rdiff -u -r1.8.10.7 -r1.8.10.8 src/sys/dev/pci/mpii.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.