Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/iscsi Work around an issue with MSG_WAITALL that wou...



details:   https://anonhg.NetBSD.org/src/rev/7e257d8d55b2
branches:  trunk
changeset: 816050:7e257d8d55b2
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Wed Jun 15 04:33:52 2016 +0000

description:
Work around an issue with MSG_WAITALL that would block for too long by
replacing it with a receive loop.

diffstat:

 sys/dev/iscsi/iscsi_rcv.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 36b7f02f20df -r 7e257d8d55b2 sys/dev/iscsi/iscsi_rcv.c
--- a/sys/dev/iscsi/iscsi_rcv.c Wed Jun 15 04:30:30 2016 +0000
+++ b/sys/dev/iscsi/iscsi_rcv.c Wed Jun 15 04:33:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iscsi_rcv.c,v 1.21 2016/06/15 04:30:30 mlelstv Exp $   */
+/*     $NetBSD: iscsi_rcv.c,v 1.22 2016/06/15 04:33:52 mlelstv Exp $   */
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -59,7 +59,16 @@
 
        DEBC(conn, 99, ("soo_read req: %zu\n", resid));
 
-       ret = (*so->so_receive)(so, NULL, u, NULL, NULL, &flags);
+       if (flags & MSG_WAITALL) {
+               flags &= ~MSG_WAITALL;
+               do {
+                       int oresid = u->uio_resid;
+                       ret = (*so->so_receive)(so, NULL, u, NULL, NULL, &flags);
+                       if (!ret && u->uio_resid == oresid)
+                               break;
+               } while (!ret && u->uio_resid > 0);
+       } else
+               ret = (*so->so_receive)(so, NULL, u, NULL, NULL, &flags);
 
        if (ret || (flags != MSG_DONTWAIT && u->uio_resid)) {
                DEBC(conn, 1, ("Read failed (ret: %d, req: %zu, out: %zu)\n",



Home | Main Index | Thread Index | Old Index