[IBBUS] prevent duplicate HCA deref in iou_mgr_iou_remove() and iou_free_iou_mgr...
authorstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 19 May 2009 19:29:18 +0000 (19:29 +0000)
committerstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 19 May 2009 19:29:18 +0000 (19:29 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2188 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/bus/kernel/bus_iou_mgr.c

index 0cce0cf..8643df8 100644 (file)
@@ -407,12 +407,14 @@ free_iou_mgr(
                {\r
                        CL_ASSERT( !p_ext->b_present );\r
                        p_ext->b_reported_missing = TRUE;\r
-                       BUS_TRACE( BUS_DBG_PNP, ("%s %s: ext %p, present %d, missing %d\n",\r
+                       BUS_TRACE( BUS_DBG_PNP,\r
+                                       ("%s Surprise-remove %s: ext %p, present %d, missing %d\n",\r
                                                p_bfi->whoami,\r
                                                p_ext->cl_ext.vfptr_pnp_po->identity, p_ext,\r
                                                p_ext->b_present, p_ext->b_reported_missing ) );\r
                        continue;\r
                }\r
+\r
                if( p_ext->h_ca )\r
                {\r
                        /* Invalidate bus relations for the HCA. */\r
@@ -422,15 +424,11 @@ free_iou_mgr(
                        /* Release the reference on the CA object. */\r
                        deref_al_obj( &p_ext->h_ca->obj );\r
                }\r
+\r
                BUS_TRACE( BUS_DBG_PNP, ("Deleted device %s %s: PDO %p, ext %p\n",\r
                                        p_bfi->whoami, p_ext->cl_ext.vfptr_pnp_po->identity,\r
                                        p_ext->cl_ext.p_self_do, p_ext ) );\r
 \r
-               BUS_TRACE( BUS_DBG_PNP,("%s p_ext->h_ca->obj.state %d ref_cnt %d\n",\r
-                                       p_bfi->whoami,\r
-                                       p_ext->h_ca->obj.state,\r
-                                       p_ext->h_ca->obj.ref_cnt));\r
-\r
                IoDeleteDevice( p_ext->cl_ext.p_self_do );\r
        }\r
 \r
@@ -552,7 +550,7 @@ iou_mgr_get_bus_relations(
                }\r
                p_rel = (DEVICE_RELATIONS*)p_irp->IoStatus.Information;\r
                if ( p_rel ) {\r
-                       BUS_PRINT(BUS_DBG_PNP, ("CA_guid 0 Reports %d\n", p_rel->Count));\r
+                       BUS_PRINT(BUS_DBG_PNP, ("CA_guid 0 Reports %d relations\n", p_rel->Count));\r
                }\r
                BUS_EXIT( BUS_DBG_PNP );\r
                return STATUS_SUCCESS;\r
@@ -743,6 +741,7 @@ iou_mgr_iou_add(
        p_iou_ext->pdo.p_parent_ext = p_bfi->p_bus_ext;\r
        p_iou_ext->pdo.b_present = TRUE;\r
        p_iou_ext->pdo.b_reported_missing = FALSE;\r
+\r
        BUS_TRACE( BUS_DBG_PNP, ("%s: ext %p, present %d, missing %d .\n",\r
                p_iou_ext->pdo.cl_ext.vfptr_pnp_po->identity, p_iou_ext,\r
                p_iou_ext->pdo.b_present, p_iou_ext->pdo.b_reported_missing ) );\r
@@ -893,6 +892,8 @@ hca_deref:
        p_pnp_rec->pnp_rec.context = NULL;\r
 \r
        deref_al_obj( &p_ext->h_ca->obj );\r
+       p_ext->h_ca = NULL;\r
+\r
        cl_mutex_release( &gp_iou_mgr->pdo_mutex );\r
 \r
        BUS_EXIT( BUS_DBG_PNP );\r
@@ -1001,7 +1002,9 @@ iou_remove(
                cl_set_pnp_state( &p_ext->pdo.cl_ext, NotStarted );\r
                /* Don't delete the device.  It may simply be disabled. */\r
                *p_action = IrpComplete;\r
-               BUS_TRACE_EXIT( BUS_DBG_PNP, ("Device still present.\n") );\r
+               BUS_TRACE_EXIT( BUS_DBG_PNP,\r
+                               ("Device %s still present: PDO %p, ext %p\n",\r
+                               p_ext->pdo.cl_ext.vfptr_pnp_po->identity, p_dev_obj, p_ext) );\r
                return STATUS_SUCCESS;\r
        }\r
 \r
@@ -1047,8 +1050,10 @@ iou_surprise_remove(
        p_ext = p_dev_obj->DeviceExtension;\r
        p_ext->pdo.b_present = FALSE;\r
        p_ext->pdo.b_reported_missing = TRUE;\r
+\r
        BUS_TRACE( BUS_DBG_PNP, ("%s: ext %p, present %d, missing %d .\n",\r
-               p_ext->pdo.cl_ext.vfptr_pnp_po->identity, p_ext, p_ext->pdo.b_present, p_ext->pdo.b_reported_missing ) );\r
+                               p_ext->pdo.cl_ext.vfptr_pnp_po->identity, p_ext,\r
+                               p_ext->pdo.b_present, p_ext->pdo.b_reported_missing ) );\r
 \r
        *p_action = IrpComplete;\r
 \r