cvs commit: src/sys/kern uipc_sockbuf.c uipc_socket.c uipc_syscalls.c src/sys/netinet sctp_input.c sctp_peeloff.c sctputil.c src/sys/sys socketvar.h

Robert Watson rwatson at
Fri Feb 1 14:51:41 PST 2008

rwatson     2008-02-01 22:51:40 UTC

  FreeBSD src repository

  Modified files:        (Branch: RELENG_7)
    sys/kern             uipc_sockbuf.c uipc_socket.c 
    sys/netinet          sctp_input.c sctp_peeloff.c sctputil.c 
    sys/sys              socketvar.h 
  Merge uipc_sockbuf.c:1.175, uipc_socket.c:1.304, uipc_syscalls.c:1.264,
  sctp_input.c:1.67, sctp_peeloff.c:1.17, sctputil.c:1.73,
  socketvar.h:1.161 from HEAD to RELENG_7:
    Correct two problems relating to sorflush(), which is called to flush
    read socket buffers in shutdown() and close():
    - Call socantrcvmore() before sblock() to dislodge any threads that
      might be sleeping (potentially indefinitely) while holding sblock(),
      such as a thread blocked in recv().
    - Flag the sblock() call as non-interruptible so that a signal
      delivered to the thread calling sorflush() doesn't cause sblock() to
      fail.  The sblock() is required to ensure that all other socket
      consumer threads have, in fact, left, and do not enter, the socket
      buffer until we're done flushin it.
    To implement the latter, change the 'flags' argument to sblock() to
    accept two flags, SBL_WAIT and SBL_NOINTR, rather than one M_WAITOK
    flag.  When SBL_NOINTR is set, it forces a non-interruptible sx
    acquisition, regardless of the setting of the disposition of SB_NOINTR
    on the socket buffer; without this change it would be possible for
    another thread to clear SB_NOINTR between when the socket buffer mutex
    is released and sblock() is invoked.
    Reviewed by:    bz, kmacy
    Reported by:    Jos Backus <jos at catnook dot com>
  Revision   Changes    Path  +6 -2      src/sys/kern/uipc_sockbuf.c
  1.302.2.1  +11 -5     src/sys/kern/uipc_socket.c  +7 -2      src/sys/kern/uipc_syscalls.c   +2 -1      src/sys/netinet/sctp_input.c   +2 -2      src/sys/netinet/sctp_peeloff.c   +1 -1      src/sys/netinet/sctputil.c  +7 -0      src/sys/sys/socketvar.h

More information about the cvs-src mailing list