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

Guy German guyg at voltaire.com
Thu Jul 28 00:20:25 PDT 2005


[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;
  }



More information about the general mailing list