[Ocfs2-commits] zab commits r1899 - in trunk: . fs/ocfs2/cluster kapi-compat/include

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Feb 21 18:45:47 CST 2005


Author: zab
Signed-off-by: manish
Date: 2005-02-21 18:45:45 -0600 (Mon, 21 Feb 2005)
New Revision: 1899

Added:
   trunk/kapi-compat/include/assert_spin_locked.h
Modified:
   trunk/configure.in
   trunk/fs/ocfs2/cluster/tcp.c
Log:
o add compat goo so we can use assert_spin_locked() with wild abandon and use
  tcp.c as a guinea pig.

Signed-off-by: manish



Modified: trunk/configure.in
===================================================================
--- trunk/configure.in	2005-02-19 01:39:11 UTC (rev 1898)
+++ trunk/configure.in	2005-02-22 00:45:45 UTC (rev 1899)
@@ -320,6 +320,14 @@
   AC_MSG_RESULT(no)
 fi
 
+AC_MSG_CHECKING([for assert_spin_locked])
+if grep "\<assert_spin_locked(" "$KERNELINC/linux/spinlock.h" >/dev/null 2>&1 ; then
+  AC_MSG_RESULT(yes)
+else
+  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS assert_spin_locked.h"
+  AC_MSG_RESULT(no)
+fi
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path

Modified: trunk/fs/ocfs2/cluster/tcp.c
===================================================================
--- trunk/fs/ocfs2/cluster/tcp.c	2005-02-19 01:39:11 UTC (rev 1898)
+++ trunk/fs/ocfs2/cluster/tcp.c	2005-02-22 00:45:45 UTC (rev 1899)
@@ -199,9 +199,10 @@
 	atomic_inc(&nmh->refcnt);
 }
 
-/* called with net_handler_lock held so we can verify the flags :/ */
 static void __net_put_handler(net_msg_handler *nmh)
 {
+	assert_spin_locked(&net_handler_lock);
+
 	if (atomic_dec_and_test(&nmh->refcnt))
 		kfree(nmh);
 }
@@ -482,12 +483,13 @@
 
 
 
-/* net_handler_lock should be held */
 static net_msg_handler * __net_lookup_handler(u32 msg_type, u32 key)
 {
 	net_msg_handler *ret;
 	struct list_head *iter;
 
+	assert_spin_locked(&net_handler_lock);
+
 	list_for_each(iter, &net_handlers) {
 		ret = list_entry(iter, net_msg_handler, list);
 		if (ret->msg_type == msg_type && ret->key == key) {
@@ -808,9 +810,10 @@
         return;
 }
 
-/* net_active_lock must be held */
 static void net_make_active(net_inode_private *net)
 {
+	assert_spin_locked(&net_active_lock);
+
 	if (list_empty(&net->active_item))
 		list_add_tail(&net->active_item, &net_active_list);
 
@@ -1148,12 +1151,13 @@
 	wait_queue_t 		entry;
 };
 
-/* must hold sock lock */
 static void net_wake_sock_waiters(net_inode_private *net, int rc)
 {
 	struct list_head *pos, *tmp;
 	struct waiting_for_sock *wfs;
 
+	assert_spin_locked(&net->sock_lock);
+
 	netprintk("net %p waking waiters with rc %d\n", net, rc);
 
 	list_for_each_safe(pos, tmp, &net->pending_waiters) {

Added: trunk/kapi-compat/include/assert_spin_locked.h
===================================================================
--- trunk/kapi-compat/include/assert_spin_locked.h	2005-02-19 01:39:11 UTC (rev 1898)
+++ trunk/kapi-compat/include/assert_spin_locked.h	2005-02-22 00:45:45 UTC (rev 1899)
@@ -0,0 +1,17 @@
+#ifndef KAPI_ASSERT_SPIN_LOCKED_H
+#define KAPI_ASSERT_SPIN_LOCKED_H
+
+/*
+http://linux.bkbits.net:8080/linux-2.5/gnupatch@420104cfKCNCOybFRuNN48-HuIMO6w
+ *
+ * We only care about checking the assertion in modern 2.6; we just want old
+ * kernels to build without errors.  We have to watch out for old jbd headers
+ * that expose this api.  (kernel namespace inconsistency 1, universe 0)
+ */
+
+#include <linux/jbd.h>
+#ifndef assert_spin_locked
+#define assert_spin_locked(lock)	do { (void)(lock); } while(0)
+#endif
+
+#endif



More information about the Ocfs2-commits mailing list