Print this page
12976 system panics with error in IP module
Reviewed by: Andy Fiddaman <andy@omniosce.org>
Reviewed by: Paul Winder <p.winder@me.com>


   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2014, 2017 by Delphix. All rights reserved.
  25  * Copyright 2019 Joyent, Inc.
  26  */
  27 
  28 /* This file contains all TCP output processing functions. */
  29 
  30 #include <sys/types.h>
  31 #include <sys/stream.h>
  32 #include <sys/strsun.h>
  33 #include <sys/strsubr.h>
  34 #include <sys/stropts.h>
  35 #include <sys/strlog.h>
  36 #define _SUN_TPI_VERSION 2
  37 #include <sys/tihdr.h>
  38 #include <sys/suntpi.h>
  39 #include <sys/xti_inet.h>
  40 #include <sys/timod.h>
  41 #include <sys/pattr.h>
  42 #include <sys/squeue_impl.h>
  43 #include <sys/squeue.h>
  44 #include <sys/sockio.h>
  45 #include <sys/tsol/tnet.h>


1660         CONN_DEC_REF(connp);
1661         ASSERT(connp->conn_ref >= (IPCL_IS_NONSTR(connp) ? 1 : 2));
1662 
1663 finish:
1664         /*
1665          * Don't change the queues in the case of a listener that has
1666          * eagers in its q or q0. It could surprise the eagers.
1667          * Instead wait for the eagers outside the squeue.
1668          *
1669          * For non-STREAMS sockets tcp_wait_for_eagers implies that
1670          * we should delay the su_closed upcall until all eagers have
1671          * dropped their references.
1672          */
1673         if (!tcp->tcp_wait_for_eagers) {
1674                 tcp->tcp_detached = B_TRUE;
1675                 connp->conn_rq = NULL;
1676                 connp->conn_wq = NULL;
1677 
1678                 /* non-STREAM socket, release the upper handle */
1679                 if (IPCL_IS_NONSTR(connp)) {
1680                         ASSERT(connp->conn_upper_handle != NULL);
1681                         (*connp->conn_upcalls->su_closed)
1682                             (connp->conn_upper_handle);










1683                         connp->conn_upper_handle = NULL;
1684                         connp->conn_upcalls = NULL;


1685                 }
1686         }
1687 
1688         /* Signal tcp_close() to finish closing. */
1689         mutex_enter(&tcp->tcp_closelock);
1690         tcp->tcp_closed = 1;
1691         cv_signal(&tcp->tcp_closecv);
1692         mutex_exit(&tcp->tcp_closelock);
1693 }
1694 
1695 /* ARGSUSED */
1696 void
1697 tcp_shutdown_output(void *arg, mblk_t *mp, void *arg2, ip_recv_attr_t *dummy)
1698 {
1699         conn_t  *connp = (conn_t *)arg;
1700         tcp_t   *tcp = connp->conn_tcp;
1701 
1702         freemsg(mp);
1703 
1704         if (tcp->tcp_fused)




   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2014, 2017 by Delphix. All rights reserved.
  25  * Copyright 2020 Joyent, Inc.
  26  */
  27 
  28 /* This file contains all TCP output processing functions. */
  29 
  30 #include <sys/types.h>
  31 #include <sys/stream.h>
  32 #include <sys/strsun.h>
  33 #include <sys/strsubr.h>
  34 #include <sys/stropts.h>
  35 #include <sys/strlog.h>
  36 #define _SUN_TPI_VERSION 2
  37 #include <sys/tihdr.h>
  38 #include <sys/suntpi.h>
  39 #include <sys/xti_inet.h>
  40 #include <sys/timod.h>
  41 #include <sys/pattr.h>
  42 #include <sys/squeue_impl.h>
  43 #include <sys/squeue.h>
  44 #include <sys/sockio.h>
  45 #include <sys/tsol/tnet.h>


1660         CONN_DEC_REF(connp);
1661         ASSERT(connp->conn_ref >= (IPCL_IS_NONSTR(connp) ? 1 : 2));
1662 
1663 finish:
1664         /*
1665          * Don't change the queues in the case of a listener that has
1666          * eagers in its q or q0. It could surprise the eagers.
1667          * Instead wait for the eagers outside the squeue.
1668          *
1669          * For non-STREAMS sockets tcp_wait_for_eagers implies that
1670          * we should delay the su_closed upcall until all eagers have
1671          * dropped their references.
1672          */
1673         if (!tcp->tcp_wait_for_eagers) {
1674                 tcp->tcp_detached = B_TRUE;
1675                 connp->conn_rq = NULL;
1676                 connp->conn_wq = NULL;
1677 
1678                 /* non-STREAM socket, release the upper handle */
1679                 if (IPCL_IS_NONSTR(connp)) {
1680                         sock_upcalls_t *upcalls = connp->conn_upcalls;
1681                         sock_upper_handle_t handle = connp->conn_upper_handle;
1682 
1683                         ASSERT(upcalls != NULL);
1684                         ASSERT(upcalls->su_closed != NULL);
1685                         ASSERT(handle != NULL);
1686                         /*
1687                          * Set these to NULL first because closed() will free
1688                          * upper structures.  Acquire conn_lock because an
1689                          * external caller like conn_get_socket_info() will
1690                          * upcall if these are non-NULL.
1691                          */
1692                         mutex_enter(&connp->conn_lock);
1693                         connp->conn_upper_handle = NULL;
1694                         connp->conn_upcalls = NULL;
1695                         mutex_exit(&connp->conn_lock);
1696                         upcalls->su_closed(handle);
1697                 }
1698         }
1699 
1700         /* Signal tcp_close() to finish closing. */
1701         mutex_enter(&tcp->tcp_closelock);
1702         tcp->tcp_closed = 1;
1703         cv_signal(&tcp->tcp_closecv);
1704         mutex_exit(&tcp->tcp_closelock);
1705 }
1706 
1707 /* ARGSUSED */
1708 void
1709 tcp_shutdown_output(void *arg, mblk_t *mp, void *arg2, ip_recv_attr_t *dummy)
1710 {
1711         conn_t  *connp = (conn_t *)arg;
1712         tcp_t   *tcp = connp->conn_tcp;
1713 
1714         freemsg(mp);
1715 
1716         if (tcp->tcp_fused)