summaryrefslogtreecommitdiffstats
path: root/sbin/ggate
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2004-05-03 18:24:41 +0000
committerpjd <pjd@FreeBSD.org>2004-05-03 18:24:41 +0000
commit9a8678bb77340423d57a2e5cd11857efb71fa7d5 (patch)
treeb89d8f0e37f266f6840e64b2963874a2c231e896 /sbin/ggate
parent3a548ca143b3950d3d488d297e833796a91c1287 (diff)
downloadFreeBSD-src-9a8678bb77340423d57a2e5cd11857efb71fa7d5.zip
FreeBSD-src-9a8678bb77340423d57a2e5cd11857efb71fa7d5.tar.gz
Don't repeat handshake.
This little thing can cause a deadlock, because taste mechanism start to work after creation of ggate provider and I/O requests are sent from other classes from the g_event thread, so number of pending events isn't 0. Now ggatec(8) start second handshake and ggated(8) is trying to open GEOM provider (for example md(4)) and it can't, because it hangs on g_waitidle() in g_dev_open(). g_waitidle() cannot finish because there is a pending read on event queue, and this read can't be finished, because ggated(8) can't open target device. GEOM Gate will recover from this deadlock, because requests will timeout, but it of course isn't the best solution and I don't know better one for now, so we should avoid opening GEOM providers while there are pending requests in event queue.
Diffstat (limited to 'sbin/ggate')
-rw-r--r--sbin/ggate/ggatec/ggatec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sbin/ggate/ggatec/ggatec.c b/sbin/ggate/ggatec/ggatec.c
index 2f90a48..bb598e6 100644
--- a/sbin/ggate/ggatec/ggatec.c
+++ b/sbin/ggate/ggatec/ggatec.c
@@ -289,15 +289,15 @@ serve_loop(int sfd)
for (;;) {
int error;
+ error = serve(sfd);
+ close(sfd);
+ if (error != EAGAIN)
+ g_gate_xlog("%s.", strerror(error));
sfd = handshake();
if (sfd < 0) {
sleep(2);
continue;
}
- error = serve(sfd);
- close(sfd);
- if (error != EAGAIN)
- g_gate_xlog("%s.", strerror(error));
}
}
OpenPOWER on IntegriCloud