[Ocfs2-commits] jlbec commits r2058 - in trunk/fs: ocfs2/cluster usysfs

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Mar 25 19:27:02 CST 2005


Author: jlbec
Signed-off-by: manish
Date: 2005-03-25 19:27:01 -0600 (Fri, 25 Mar 2005)
New Revision: 2058

Modified:
   trunk/fs/ocfs2/cluster/nodemanager.c
   trunk/fs/usysfs/bobtest.c
   trunk/fs/usysfs/dir.c
   trunk/fs/usysfs/usysfs_internal.h
Log:

o Fix bobtest and nodemanager to clean up their default sets
o Fix a double-put in the default_set code.

Signed-off-by: manish



Modified: trunk/fs/ocfs2/cluster/nodemanager.c
===================================================================
--- trunk/fs/ocfs2/cluster/nodemanager.c	2005-03-26 01:15:38 UTC (rev 2057)
+++ trunk/fs/ocfs2/cluster/nodemanager.c	2005-03-26 01:27:01 UTC (rev 2058)
@@ -214,6 +214,7 @@
 {
 	struct nm_node *node = to_nm_node(uobj);
 	printk("releasing node %p\n", node);
+	/* FIXME: must free! */
 }
 
 static ssize_t nm_node_num_read(struct nm_node *node, char *page)
@@ -658,10 +659,18 @@
 static void nm_cluster_set_drop_object(struct uset *uset, struct uobject *uobj)
 {
 	struct nm_cluster *cluster = to_nm_cluster(uobj);
+	int i;
+	struct uobject *killme;
 
 	BUG_ON(nm_single_cluster != cluster);
 	nm_single_cluster = NULL;
 
+	for (i = 0; cluster->cl_uset.default_sets[i]; i++) {
+		killme = &cluster->cl_uset.default_sets[i]->uobj;
+		cluster->cl_uset.default_sets[i] = NULL;
+		uobject_put(killme);
+	}
+
 	uobject_put(uobj);
 }
 
@@ -699,20 +708,15 @@
 
 	hb_init();
 	ret = net_register_hb_callbacks();
-	if (ret)
-		goto out;
-
-	uset_init(&nm_cluster_set.cs_uset);
-	ret = usysfs_register_subsystem(&nm_cluster_set.cs_uset);
-	if (ret) {
-		printk(KERN_ERR "nodemanager: Registration returned %d\n", ret);
-		goto out;
+	if (!ret) {
+		uset_init(&nm_cluster_set.cs_uset);
+		ret = usysfs_register_subsystem(&nm_cluster_set.cs_uset);
+		if (ret) {
+			printk(KERN_ERR "nodemanager: Registration returned %d\n", ret);
+			net_unregister_hb_callbacks();
+		}
 	}
 
-out:
-	if (ret)
-		exit_nm();
-
 	return ret;
 }
 

Modified: trunk/fs/usysfs/bobtest.c
===================================================================
--- trunk/fs/usysfs/bobtest.c	2005-03-26 01:15:38 UTC (rev 2057)
+++ trunk/fs/usysfs/bobtest.c	2005-03-26 01:27:01 UTC (rev 2058)
@@ -575,7 +575,7 @@
 	struct tom *tom = to_tom(uobj);
 
 	printk("Oooh, that's gonna leave a mark!\n");
-	kfree(to_jerry(&tom->uset.default_sets[0]->uobj));
+	kfree(tom->uset.default_sets);
 	kfree(tom);
 }
 
@@ -697,8 +697,6 @@
 
 	uobject_put(&tom->uset.default_sets[0]->uobj);
 
-	kfree(tom->uset.default_sets);
-
 	tomset->n_toms--;
 	uobject_put(uobj);
 }

Modified: trunk/fs/usysfs/dir.c
===================================================================
--- trunk/fs/usysfs/dir.c	2005-03-26 01:15:38 UTC (rev 2057)
+++ trunk/fs/usysfs/dir.c	2005-03-26 01:27:01 UTC (rev 2058)
@@ -402,8 +402,9 @@
 		if (!sd->s_element ||
 		    !(sd->s_type & USYSFS_DEFAULT_DIR))
 			continue;
-		list_del_init(&sd->s_sibling);
+
 		child = sd->s_dentry;
+
 		/* And now we're faking rmdir.  Viro must hate me */
 		down(&child->d_inode->i_sem);
 		usysfs_drop_set(sd->s_element);
@@ -412,7 +413,6 @@
 
 		d_delete(child);
 		dput(child);
-		usysfs_put(sd);
 	}
 
 	/**

Modified: trunk/fs/usysfs/usysfs_internal.h
===================================================================
--- trunk/fs/usysfs/usysfs_internal.h	2005-03-26 01:15:38 UTC (rev 2057)
+++ trunk/fs/usysfs/usysfs_internal.h	2005-03-26 01:27:01 UTC (rev 2058)
@@ -111,7 +111,8 @@
 
 static inline void release_usysfs_dirent(struct usysfs_dirent * sd)
 {
-	kfree(sd);
+	if (!(sd->s_type & USYSFS_ROOT))
+		kfree(sd);
 }
 
 static inline struct usysfs_dirent * usysfs_get(struct usysfs_dirent * sd)
@@ -125,6 +126,7 @@
 
 static inline void usysfs_put(struct usysfs_dirent * sd)
 {
+	WARN_ON(!atomic_read(&sd->s_count));
 	if (atomic_dec_and_test(&sd->s_count))
 		release_usysfs_dirent(sd);
 }



More information about the Ocfs2-commits mailing list