Index: sys/sys/socketvar.h =================================================================== --- sys/sys/socketvar.h +++ sys/sys/socketvar.h @@ -344,6 +344,14 @@ SOCK_UNLOCK(so); \ } while (0) +#define sorele_unlocked(so) do { \ + SOCK_UNLOCK_ASSERT(so); \ + if (!refcount_release_if_not_last(&(so)->so_count)) { \ + SOCK_LOCK(so); \ + sorele(so); \ + } \ +} while (0) + /* * In sorwakeup() and sowwakeup(), acquire the socket buffer lock to * avoid a non-atomic test-and-wakeup. However, sowakeup is