[SRP] fixes the BSOD when SRPT disconnects.
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 1 Jun 2008 14:19:59 +0000 (14:19 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 1 Jun 2008 14:19:59 +0000 (14:19 +0000)
Suggested by: Eleanor Witiak [eleanor.witiak@qlogic.com]

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1223 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/srp/kernel/srp_connection.c
ulp/srp/kernel/srp_session.c

index 303738a..1cccb7c 100644 (file)
@@ -288,23 +288,25 @@ __srp_cm_dreq_cb(
 {\r
        srp_session_t   *p_srp_session = (srp_session_t* VOID_PTR64)p_cm_dreq_rec->qp_context;\r
        srp_hba_t       *p_hba = p_srp_session->p_hba;\r
-       ib_cm_drep_t    cm_drep;\r
-       ib_api_status_t status;\r
 \r
        SRP_ENTER( SRP_DBG_PNP );\r
 \r
        cl_obj_lock( &p_srp_session->obj );\r
-       p_srp_session->connection.state = SRP_CONNECT_FAILURE;\r
-       cl_obj_unlock( &p_srp_session->obj );\r
-\r
-       cm_drep.p_drep_pdata = NULL;\r
-       cm_drep.drep_length = 0;\r
 \r
-       status = p_hba->ifc.cm_drep( p_cm_dreq_rec->h_cm_dreq, &cm_drep );\r
-       if ( status != IB_SUCCESS )\r
+       if (p_srp_session->connection.state == SRP_CONNECTED)\r
        {\r
-               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
-                       ("Cannot respond to target disconnect request. Status = %d\n", status) );\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_PNP,\r
+                       ("**** SRP_CONNECTED => SRP_CONNECT_FAILURE. \n") );\r
+               p_srp_session->connection.state = SRP_CONNECT_FAILURE;\r
+               cl_obj_unlock( &p_srp_session->obj );\r
+       }\r
+       else  // since the connection is no longer there, just exit\r
+       {\r
+               cl_obj_unlock( &p_srp_session->obj );\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_PNP,\r
+                       ("**** NOT SRP_CONNECTED *****. connection state = %d\n", p_srp_session->connection.state) );\r
+               SRP_EXIT( SRP_DBG_PNP );\r
+               return; \r
        }\r
 \r
        SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_PNP,\r
index 0f547d5..c9dfdd2 100644 (file)
@@ -58,7 +58,15 @@ __srp_destroying_session(
 \r
        p_srp_session = PARENT_STRUCT( p_obj, srp_session_t, obj );\r
 \r
+       cl_obj_lock( &p_srp_session->obj );\r
+       if( p_srp_session->connection.state != SRP_CONNECT_FAILURE )\r
+       {\r
+               cl_obj_unlock( &p_srp_session->obj );\r
+               return;\r
+       }\r
+\r
        p_srp_session->connection.state = SRP_CONNECTION_CLOSING;\r
+       cl_obj_unlock( &p_srp_session->obj );\r
 \r
        SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                ("Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) );\r