[openib-general][PATCH][kdapltest]: inc/dec module ref count

Hal Rosenstock halr at voltaire.com
Thu Jul 28 04:09:34 PDT 2005


Hi Guy,

On Thu, 2005-07-28 at 03:20, Guy German wrote:
> [kdapltest]: Prevents the oops occurred when removing the kdapltest module 
> while kdapltest server is up.
> 
> Index: dapltest/kdapl/kdapl_module.c
> ===================================================================
> --- dapltest/kdapl/kdapl_module.c	(revision 2899)
> +++ dapltest/kdapl/kdapl_module.c	(working copy)
> @@ -55,6 +55,8 @@ static int kdapltest_open(struct inode *
>   {
>   #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
>   	MOD_INC_USE_COUNT;
> +#else
> +	try_module_get(THIS_MODULE);
>   #endif
>   	return 0;
>   }
> @@ -63,6 +65,8 @@ static int kdapltest_release(struct inod
>   {
>   #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
>   	MOD_DEC_USE_COUNT;
> +#else
> +	module_put(THIS_MODULE);
>   #endif
>   	return 0;
>   }

This is in the right direction.

The OpenIB policy is to support the latest kernels only. So the #if
might be removed and just the 2.6 code remain in kdapl_module.c.

-- Hal




More information about the general mailing list