cvs commit: src/sys/kern uipc_socket.c uipc_socket2.c uipc_syscalls.c

Robert Watson rwatson at FreeBSD.org
Fri Jun 18 20:23:21 PDT 2004


rwatson     2004-06-19 03:23:14 UTC

  FreeBSD src repository

  Modified files:
    sys/kern             uipc_socket.c uipc_socket2.c 
                         uipc_syscalls.c 
  Log:
  Assert socket buffer lock in sb_lock() to protect socket buffer sleep
  lock state.  Convert tsleep() into msleep() with socket buffer mutex
  as argument.  Hold socket buffer lock over sbunlock() to protect sleep
  lock state.
  
  Assert socket buffer lock in sbwait() to protect the socket buffer
  wait state.  Convert tsleep() into msleep() with socket buffer mutex
  as argument.
  
  Modify sofree(), sosend(), and soreceive() to acquire SOCKBUF_LOCK()
  in order to call into these functions with the lock, as well as to
  start protecting other socket buffer use in their implementation.  Drop
  the socket buffer mutexes around calls into the protocol layer, around
  potentially blocking operations, for copying to/from user space, and
  VM operations relating to zero-copy.  Assert the socket buffer mutex
  strategically after code sections or at the beginning of loops.  In
  some cases, modify return code to ensure locks are properly dropped.
  
  Convert the potentially blocking allocation of storage for the remote
  address in soreceive() into a non-blocking allocation; we may wish to
  move the allocation earlier so that it can block prior to acquisition
  of the socket buffer lock.
  
  Drop some spl use.
  
  NOTE: Some races exist in the current structuring of sosend() and
  soreceive().  This commit only merges basic socket locking in this
  code; follow-up commits will close additional races.  As merged,
  these changes are not sufficient to run without Giant safely.
  
  Reviewed by:    juli, tjr
  
  Revision  Changes    Path
  1.182     +60 -25    src/sys/kern/uipc_socket.c
  1.133     +6 -2      src/sys/kern/uipc_socket2.c
  1.194     +21 -0     src/sys/kern/uipc_syscalls.c


More information about the cvs-src mailing list