[ofw] [PATCH] Fix object destruction

Leonid Keller leonid at mellanox.co.il
Wed Jul 2 11:05:10 PDT 2008


Applied in 1329. Thank you. 

> -----Original Message-----
> From: ofw-bounces at lists.openfabrics.org 
> [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Fab Tillier
> Sent: Wednesday, July 02, 2008 8:24 PM
> To: ofw at lists.openfabrics.org
> Subject: [ofw] [PATCH] Fix object destruction
> 
> This patch fixes IBAL object destruction.  It does the following:
> 
> 1. Removes forcing synchronous destruction for user-mode 
> exported objects.  This isn't needed, and slows down cleanup 
> of the object hierarchy.
> 
> 2. Clears the user-mode exported handle from the handle table 
> before invoking the 'destroying' callback of an object, so 
> that all further reference on the object will fail.  
> Currently, an IOCTL could take a reference on an object after 
> the 'destroying' callback has returned.
> 
> Signed-off-by: Fab Tillier <ftillier at microsoft.com>
> 
> diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: 
> old\core\al\al_common.c trunk\core\al\al_common.c
> --- old\core\al\al_common.c     Thu Jun 26 20:35:14 2008
> +++ trunk\core\al\al_common.c   Wed Jul 02 10:19:12 2008
> @@ -187,7 +187,7 @@ init_al_obj(
> 
>         p_obj->context = context;
> 
> -       if( async_destroy && !(p_obj->type & 
> AL_OBJ_SUBTYPE_UM_EXPORT) )
> +       if( async_destroy )
>                 p_obj->pfn_destroy = async_destroy_obj;
>         else
>                 p_obj->pfn_destroy = sync_destroy_obj; @@ 
> -586,18 +586,21 @@ destroy_obj(
>         cl_spinlock_release( &p_obj->lock );
>         deref_al_obj( p_obj );
> 
> -       /* Notify the object that it is being destroyed. */
> -       if( p_obj->pfn_destroying )
> -               p_obj->pfn_destroying( p_obj );
> -
>  #ifdef CL_KERNEL
> -       /* Release this object's handle. */
> +       /*
> +        * Release this object's handle.  We must do this 
> before calling the
> +        * destroy callback so that any IOCTLs referencing 
> this object will fail
> +        */
>         if( p_obj->hdl != AL_INVALID_HANDLE )
>         {
>                 CL_ASSERT( p_obj->h_al );
>                 al_hdl_free_obj( p_obj );
>         }
>  #endif
> +
> +       /* Notify the object that it is being destroyed. */
> +       if( p_obj->pfn_destroying )
> +               p_obj->pfn_destroying( p_obj );
> 
>         if( p_obj->p_parent_obj )
>                 detach_al_obj( p_obj );
> 



More information about the ofw mailing list