Subject: Re: port-sparc64/31925: smartd panics NetBSD 2.0.2_STABLE on sparc64
To: None <port-sparc64-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: Martin Husemann <martin@duskware.de>
List: netbsd-bugs
Date: 10/31/2005 00:20:01
The following reply was made to PR port-sparc64/31925; it has been noted by GNATS.

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: Manuel Bouyer <bouyer@NetBSD.org>
Subject: Re: port-sparc64/31925: smartd panics NetBSD 2.0.2_STABLE on sparc64
Date: Mon, 31 Oct 2005 01:19:47 +0100

 Ok, in -current (modulo a slight kern/kern_physio problem that I avoided by
 downgrading to r1.61) I can reproduce the problem by running
 
   smartctl -a /dev/sd0c
 
 in single user mode. IMHO the problem should be fixed in the esiop driver,
 and the following patch avoids it for me. The real fix probably would
 avoid setting XS_CTL_DATA_OUT for commands that do not send any data.
 
 Martin
 
 Index: esiop.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ic/esiop.c,v
 retrieving revision 1.33
 diff -u -p -r1.33 esiop.c
 --- esiop.c	23 Mar 2005 21:23:15 -0000	1.33
 +++ esiop.c	31 Oct 2005 00:04:44 -0000
 @@ -1182,7 +1182,8 @@ esiop_scsicmd_end(esiop_cmd, offset)
  		printf("invalid status code %d\n", xs->status);
  		xs->error = XS_DRIVER_STUFFUP;
  	}
 -	if (xs->xs_control & (XS_CTL_DATA_IN | XS_CTL_DATA_OUT)) {
 +	if ((xs->datalen > 0) &&
 +	    (xs->xs_control & (XS_CTL_DATA_IN | XS_CTL_DATA_OUT))) {
  		bus_dmamap_sync(sc->sc_c.sc_dmat,
  		    esiop_cmd->cmd_c.dmamap_data, 0,
  		    esiop_cmd->cmd_c.dmamap_data->dm_mapsize,
 @@ -1572,7 +1573,8 @@ esiop_scsipi_request(chan, req, arg)
  			splx(s);
  			return;
  		}
 -		if (xs->xs_control & (XS_CTL_DATA_IN | XS_CTL_DATA_OUT)) {
 +		if ((xs->datalen > 0) &&
 +		    (xs->xs_control & (XS_CTL_DATA_IN | XS_CTL_DATA_OUT))) {
  			error = bus_dmamap_load(sc->sc_c.sc_dmat,
  			    esiop_cmd->cmd_c.dmamap_data, xs->data, xs->datalen,
  			    NULL, BUS_DMA_NOWAIT | BUS_DMA_STREAMING |