summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2016-01-11 16:34:50 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2016-01-11 16:34:50 +0000
commitb581c14c32881053dcc5d49262bb7d7ad7644ac9 (patch)
tree47f889efd7155c6bfe924d1b94b0ab3228080a98 /sys/dev
parentb4ecda13c6234e99a85e70551be35a65dca7fb0e (diff)
Do not fail when receiving an empty reply (or directory node) in
xs_intr() but put an empty message in the queue. This prevents xs_reply() from being stuck in an endless loop because it expectes a message in the queue to break out of it. Depends on mikeb@'s previous commit because it would otherwise panic on trying to cleanup the empty message. OK mikeb@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pv/xenstore.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/dev/pv/xenstore.c b/sys/dev/pv/xenstore.c
index 654602ff745..5e7f24d0f11 100644
--- a/sys/dev/pv/xenstore.c
+++ b/sys/dev/pv/xenstore.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xenstore.c,v 1.13 2016/01/11 16:14:16 mikeb Exp $ */
+/* $OpenBSD: xenstore.c,v 1.14 2016/01/11 16:34:49 reyk Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
@@ -559,9 +559,6 @@ xs_intr(void *arg)
memcpy(&xsm->xsm_hdr, &xmh, sizeof(xmh));
xs->xs_rmsg = xsm;
-
- if (avail == 0)
- goto out;
}
if (xsm->xsm_hdr.xmh_len > xsm->xsm_dlen)
@@ -570,11 +567,16 @@ xs_intr(void *arg)
xsm->xsm_hdr.xmh_rid);
len = MIN(xsm->xsm_hdr.xmh_len - xsm->xsm_read, avail);
- if ((len = xs_ring_get(xs, &xsm->xsm_data[xsm->xsm_read], len)) <= 0) {
- printf("%s: read failure %d\n", sc->sc_dev.dv_xname, len);
- goto out;
+ if (len) {
+ /* Get data if reply is not empty */
+ if ((len = xs_ring_get(xs,
+ &xsm->xsm_data[xsm->xsm_read], len)) <= 0) {
+ printf("%s: read failure %d\n", sc->sc_dev.dv_xname,
+ len);
+ goto out;
+ }
+ xsm->xsm_read += len;
}
- xsm->xsm_read += len;
/* Notify reader that we've managed to read the whole message */
if (xsm->xsm_read == xsm->xsm_hdr.xmh_len) {