Recursive lock panic of unp_link_wlock

Raviprakash Darbha rdarbha at juniper.net
Wed May 18 17:21:16 UTC 2016


Hello All

I have hit a condition where unp_link_wlock  is being called twice in the same thread ( recursive locking)  but it hits a panic as its not a recursive lock. Wondering if this has been observed. The file in context is sys/kern/uipc_usrreq.c and sys/kern/uipc_socket.c . The exact call stack observed is:

UNP_LINK_WLOCK();         <————————————————————————  1 st call
…..
…..
if (so->so_proto->pr_flags & PR_CONNREQUIRED) {

                if (so2->so_options & SO_ACCEPTCONN) {

                      CURVNET_SET(so2->so_vnet);

                       so3 = sonewconn(so2, 0);

                          // Expanding sonewconn

                       {

                           sonewconn

                            {

    ……

    soalloc

    …….

      pru_attach

      ……..

        if (!(head->so_options & SO_ACCEPTCONN) &&

             ((head->so_proto->pr_protocol != IPPROTO_SCTP) ||

              (head->so_type != SOCK_SEQPACKET))) {

                 SOCK_LOCK(so);

                 so->so_head = NULL;

                 sofree(so);             /* NB: returns ACCEPT_UNLOCK'ed. */

                // Expanding sofree

                {

                      …….

                        ……..

                      pru_detach

                      // expanding pru_detach

                        {

                            // Recursive wlock acquiring.

                            UNP_LINK_WLOCK()     <————————————————————  2nd Call

                        }

                }



Let me know if any other details are needed. Not sure if this is call stack is expected. This is observed on Stable 10 as well as head,

Thanks

RaviPrakash Darbha

rdarbha at juniper.net<mailto:rdarbha at juniper.net>





More information about the freebsd-hackers mailing list