Print this page
8634 epoll fails to wake on certain edge-triggered conditions
8635 epoll should not emit POLLNVAL
8636 recursive epoll should emit EPOLLRDNORM
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/sockmods/socksdp.c
          +++ new/usr/src/uts/common/inet/sockmods/socksdp.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright 2017 Joyent, Inc.
  24   25   */
  25   26  
  26   27  #include <sys/types.h>
  27   28  #include <sys/t_lock.h>
  28   29  #include <sys/param.h>
  29   30  #include <sys/systm.h>
  30   31  #include <sys/buf.h>
  31   32  #include <sys/vfs.h>
  32   33  #include <sys/vnode.h>
  33   34  #include <sys/debug.h>
↓ open down ↓ 1051 lines elided ↑ open up ↑
1085 1086                  /*
1086 1087                   * Not connected yet - turn off write side events
1087 1088                   */
1088 1089                  events &= ~(POLLOUT|POLLWRBAND);
1089 1090          }
1090 1091  
1091 1092          /*
1092 1093           * Check for errors
1093 1094           */
1094 1095          if (so->so_error != 0 &&
1095      -            ((POLLIN|POLLRDNORM|POLLOUT) & origevents)  != 0) {
     1096 +            ((POLLIN|POLLRDNORM|POLLOUT) & origevents) != 0) {
1096 1097                  *reventsp = (POLLIN|POLLRDNORM|POLLOUT) & origevents;
1097      -                return (0);
     1098 +                goto done;
1098 1099          }
1099 1100  
1100 1101          *reventsp = 0;
     1102 +        if (so->so_type != SOCK_STREAM) {
     1103 +                goto done;
     1104 +        }
1101 1105  
1102 1106          /*
1103      -         * Don't mark socket as writable until TX queued data is
1104      -         * below watermark.
     1107 +         * Don't mark socket writable until TX queued data is below watermark.
1105 1108           */
1106      -        if (so->so_type == SOCK_STREAM) {
1107      -                if (sdp_polldata(
1108      -                    (struct sdp_conn_struct_t *)so->so_proto_handle,
1109      -                    SDP_XMIT)) {
1110      -                        *reventsp |= POLLOUT & events;
1111      -                }
1112      -        } else {
1113      -                *reventsp = 0;
1114      -                goto done;
     1109 +        if (sdp_polldata((struct sdp_conn_struct_t *)so->so_proto_handle,
     1110 +            SDP_XMIT)) {
     1111 +                *reventsp |= POLLOUT & events;
1115 1112          }
1116 1113  
1117 1114          if (sdp_polldata((struct sdp_conn_struct_t *)so->so_proto_handle,
1118 1115              SDP_READ)) {
1119 1116                  *reventsp |= (POLLIN|POLLRDNORM) & events;
1120 1117          }
1121 1118  
1122 1119          if ((so_state & SS_CANTRCVMORE) || (so->so_acceptq_len > 0)) {
1123 1120                  *reventsp |= (POLLIN|POLLRDNORM) & events;
1124 1121          }
1125 1122  
1126 1123  done:
1127      -        if (!*reventsp && !anyyet) {
     1124 +        if ((*reventsp == 0 && !anyyet) || (events & POLLET)) {
1128 1125                  *phpp = &so->so_poll_list;
1129 1126          }
1130 1127  
1131 1128          return (0);
1132 1129  }
1133 1130  
1134 1131  /* ARGSUSED */
1135 1132  static int
1136 1133  sosdp_close(struct sonode *so, int flag, struct cred *cr)
1137 1134  {
↓ open down ↓ 223 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX