Module Name: src
Committed By: jdolecek
Date: Tue Oct 4 18:20:49 UTC 2016
Modified Files:
src/sys/dev/pci: vioscsi.c
Log Message:
vioscsi_req_get()/virtio_enqueue_prep() failing is actually perfectly
normal - observed failures included 10, 27, 61 in-flight commands,
so probably depends on particular command mix; return with
XS_RESOURCE_SHORTAGE rather then panic
do vioscsi_req_put() when initial bus_dmamap_load() fails, as suggested
by the XXX; the vq_done hook is called by virtio, but in that case we never
get to commit the request to it
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/vioscsi.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/vioscsi.c
diff -u src/sys/dev/pci/vioscsi.c:1.6 src/sys/dev/pci/vioscsi.c:1.7
--- src/sys/dev/pci/vioscsi.c:1.6 Sun Nov 1 08:55:05 2015
+++ src/sys/dev/pci/vioscsi.c Tue Oct 4 18:20:49 2016
@@ -1,3 +1,4 @@
+/* $NetBSD: vioscsi.c,v 1.7 2016/10/04 18:20:49 jdolecek Exp $ */
/* $OpenBSD: vioscsi.c,v 1.3 2015/03/14 03:38:49 jsg Exp $ */
/*
@@ -17,7 +18,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.6 2015/11/01 08:55:05 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.7 2016/10/04 18:20:49 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -227,16 +228,15 @@ vioscsi_scsipi_request(struct scsipi_cha
periph = xs->xs_periph;
vr = vioscsi_req_get(sc);
-#ifdef DIAGNOSTIC
/*
- * This should never happen as we track the resources
- * in the mid-layer.
+ * This can happen when we run out of queue slots.
*/
if (vr == NULL) {
- scsipi_printaddr(xs->xs_periph);
- panic("%s: unable to allocate request\n", __func__);
+ xs->error = XS_RESOURCE_SHORTAGE;
+ scsipi_done(xs);
+ return;
}
-#endif
+
req = &vr->vr_req;
slot = vr - sc->sc_reqs;
@@ -284,7 +284,7 @@ vioscsi_scsipi_request(struct scsipi_cha
stuffup:
xs->error = XS_DRIVER_STUFFUP;
nomore:
- // XXX: free req?
+ vioscsi_req_put(sc, vr);
scsipi_done(xs);
return;
}