From: jsing Date: Mon, 12 Jun 2017 15:43:25 +0000 (+0000) Subject: Upon failure, only return zero from the softraid ioctl handler when there X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=67b0176846ca60b9c580da5186893752a354a32b;p=openbsd Upon failure, only return zero from the softraid ioctl handler when there is at least one bio status message. It is a much nicer user experience when we properly report failures, however in the case that we fail to do this, getting an errno back from the ioctl is somewhat better than simply printing "unknown error" from bioctl(8). --- diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index 426238be86f..c392a17a161 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.381 2017/06/06 19:01:27 krw Exp $ */ +/* $OpenBSD: softraid.c,v 1.382 2017/06/12 15:43:25 jsing Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Marco Peereboom * Copyright (c) 2008 Chris Kuethe @@ -2569,11 +2569,14 @@ sr_bio_handler(struct sr_softc *sc, struct sr_discipline *sd, u_long cmd, sc->sc_status.bs_status = (rv ? BIO_STATUS_ERROR : BIO_STATUS_SUCCESS); + if (sc->sc_status.bs_msg_count > 0) + rv = 0; + memcpy(&bio->bio_status, &sc->sc_status, sizeof(struct bio_status)); rw_exit_write(&sc->sc_lock); - return (0); + return (rv); } int