NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/57133



The following reply was made to PR kern/57133; it has been noted by GNATS.

From: Brian Buhrow <buhrow%nfbcal.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: buhrow%nfbcal.org@localhost
Subject: Re: kern/57133
Date: Tue, 17 Oct 2023 22:16:29 -0700

 	Hello.  Further analysis reveals the trouble, as explained below.  Also, I provide a diff
 to mpii.c that fixes the problem.  Can the original submitter of this bug test the below patch
 to see if it addresses their issue?  If it does, I'll commit the fix and request pullups to
 NetBSD-8 and NetBSD-9, since the bug was introduced to both of those releases.
 
 -thanks
 -Brian
 
 
 	Hello.  Okay.  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.
 
 
 The below patch implements this change.
 
 
 Index: mpii.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/mpii.c,v
 retrieving revision 1.29
 diff -u -r1.29 mpii.c
 --- mpii.c	7 Aug 2021 16:19:14 -0000	1.29
 +++ mpii.c	18 Oct 2023 05:09:53 -0000
 @@ -3264,7 +3264,6 @@
  			break;
  
  		case MPII_SCSIIO_STATUS_CHECK_COND:
 -			xs->resid = 0;
  			xs->error = XS_SENSE;
  			break;
  
 


Home | Main Index | Thread Index | Old Index