Adds teardown fucntionality to rcfs. Goes thru the directory structure
and
deletes all the directory depth first and calls ckrm_teardown().

--
 fs/rcfs/inode.c      |    9 +++------
 fs/rcfs/taskclass.c  |   17 +++++++++++++++++
 include/linux/rcfs.h |    1 +
 3 files changed, 21 insertions(+), 6 deletions(-)

Index: linux-2.6.13f.uml/fs/rcfs/inode.c
===================================================================
--- linux-2.6.13f.uml.orig/fs/rcfs/inode.c
+++ linux-2.6.13f.uml/fs/rcfs/inode.c
@@ -620,6 +620,8 @@ static void rcfs_kill_sb(struct super_bl
        if (!sb->s_root)
                goto out;
 
+       rcfs_teardown(sb->s_root);
+       ckrm_teardown();
        rc = rcfs_destroy_virtual(sb->s_root);
        if (rc) {
                err("Magic file destroy failed %d\n", rc);
@@ -658,11 +660,6 @@ static int __init init_rcfs_fs(void)
        if (ret)
                goto out_register;
 
-       /*
-        * Due to tight coupling of this module with ckrm
-        * do not allow this module to be removed.
-        */
-       try_module_get(THIS_MODULE);
        return ret;
 
 out_register:
Index: linux-2.6.13f.uml/fs/rcfs/taskclass.c
===================================================================
--- linux-2.6.13f.uml.orig/fs/rcfs/taskclass.c
+++ linux-2.6.13f.uml/fs/rcfs/taskclass.c
@@ -83,6 +83,23 @@ out:
        return rc;
 }
 
+void
+rcfs_teardown(struct dentry *parent)
+{
+       struct dentry *tmp, *child;
+
+       if (!parent)
+               return;
+
+       list_for_each_entry_safe(child, tmp, &parent->d_subdirs, d_child) {
+               if (S_ISDIR(child->d_inode->i_mode))
+                       rcfs_teardown(child);
+       }
+       if (parent != parent->d_sb->s_root)
+               rcfs_tc_rmdir(parent->d_parent->d_inode, parent);
+       return;
+}
+
 struct inode_operations rcfs_taskclass_dir_ops = {
        .create         = rcfs_create_noperm,
        .lookup         = simple_lookup,
Index: linux-2.6.13f.uml/include/linux/rcfs.h
===================================================================
--- linux-2.6.13f.uml.orig/include/linux/rcfs.h
+++ linux-2.6.13f.uml/include/linux/rcfs.h
@@ -57,6 +57,7 @@ extern int rcfs_mknod_noperm(struct inod
 extern int rcfs_rename_noperm(struct inode *, struct dentry *,
                                        struct inode *, struct dentry *);
 extern int rcfs_unlink_noent(struct inode *dir, struct dentry *dentry);
+extern void rcfs_teardown(struct dentry *dentry);
 
 static inline struct rcfs_inode_info *
 rcfs_get_inode_info(struct inode *inode)

-- 

----------------------------------------------------------------------
    Chandra Seetharaman               | Be careful what you choose....
              - [EMAIL PROTECTED]   |      .......you may get it.
----------------------------------------------------------------------




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
ckrm-tech mailing list
https://lists.sourceforge.net/lists/listinfo/ckrm-tech

Reply via email to