Subject: Re: panic: dequeued wrong buf in -current
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
From: Jason Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 09/08/2004 13:31:20
--Apple-Mail-2-404163960
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII; format=flowed


On Sep 8, 2004, at 1:29 PM, Jason Thorpe wrote:

> +		/* with a scsipi_xfer preallocated, scsipi_command can't fail */
> +		error = scsipi_command(periph, xs, cmdp, cmdlen,
> +		    (u_char *)bp->b_data, bp->b_bcount,
> +		    CDRETRIES, 30000, bp, flags);
> +#ifdef DIAGNOSTIC
> +		if (__predict_false(error)) {
> +			disk_unbusy(&cd->sc_dk, 0, 0);
> +			printf("%s: not queued, error %d\n",
> +			    cd->sc_dev.dv_xname, error);
> +			bp->b_flags |= B_ERROR;
> +			bp->b_error = ENOMEM;
> +			biodone(bp);
> +		}
> +#endif
>
> If it can't fail in this case, then just do:
>
> 	KASSERT(error == 0);
>
> Why bother recovering from something that can't happen? :-)

Hm, noticed something else... even if you disagree with me about the 
KASSERT(), then you should at least set b_error to error, instead of 
assuming ENOMEM.

         -- Jason R. Thorpe <thorpej@wasabisystems.com>


--Apple-Mail-2-404163960
content-type: application/pgp-signature; x-mac-type=70674453;
	name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iD8DBQFBP2wYOpVKkaBm8XkRAim4AJ9k+3GQgnL7VlmSoVWc/NekCfCCawCgkk3z
avwyjy0ZB+unl+ETf/Ua4ZQ=
=gzCs
-----END PGP SIGNATURE-----

--Apple-Mail-2-404163960--