commit 8f16a4fa28ab93bf43f6f23c8894f36028146b59
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Mon May 14 21:28:00 2007 -0400

    export: fixed some reference leaks

diff --git a/fs/unionfs/export.c b/fs/unionfs/export.c
index f37c6c9..5710a1a 100644
--- a/fs/unionfs/export.c
+++ b/fs/unionfs/export.c
@@ -1,5 +1,7 @@
 #include "union.h"
 
+#define is_anon(d) ((d)->d_flags & DCACHE_DISCONNECTED)
+
 static struct dentry *__get_parent(struct super_block *sb, struct dentry 
*odf_dentry)
 {
        struct dentry *odf_root = UNIONFS_SB(sb)->odf->odi_ns->dentry;
@@ -21,12 +23,13 @@ static struct dentry *__get_parent(struct super_block *sb, 
struct dentry *odf_de
        } while (d != odf_root);
 
        parent = sb->s_root;
+       dget(parent);
        while (stack.n) {
                d = __ds_pop(&stack);
                child = lookup_one_len(d->d_name.name, parent, d->d_name.len);
+               dput(parent);
                if (IS_ERR(child))
                        break;
-               dput(parent);
                parent = child;
        }
 
@@ -61,13 +64,15 @@ static struct dentry *unionfs_get_parent(struct dentry 
*child)
 
        odf_parent = odf_sb->s_export_op->get_parent(odf_child);
        if (IS_ERR(odf_parent)) {
-               iput(odf_i);
+               dput(odf_child);
                res = odf_parent;
                goto out;
        }
 
        res = __get_parent(child->d_sb, odf_parent);
 
+       dput(odf_child);
+       dput(odf_parent);
 out:
        return res;
 }
@@ -142,10 +147,9 @@ static int unionfs_get_name(struct dentry *dentry, char 
*name, struct dentry *ch
                        strncpy(name, tmp_name, namelen);
                        name[namelen] = 0;
                        err = 0;
-                       
                        break;
                }
-               
+
                err = -ENOENT;
                kfree(tmp_name);
                tmp_name = NULL;
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index 50cfc93..8f9d38b 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -408,7 +408,7 @@ static int unionfs_mkdir(struct inode *parent, struct 
dentry *dentry, int mode)
        err = odf_purge_dir_cache(dentry->d_parent);
        if (err)
                goto out;
-       
+
        /* only INTERPOSE_LOOKUP can return a value other than 0 or err */
        err = PTR_ERR(unionfs_interpose(dentry, parent->i_sb, 0));
        if (!err) {
diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index 72e62fc..b2f0e7d 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -149,8 +149,8 @@ fill_i_info:
        /* all well, copy inode attributes */
        fsstack_copy_attr_all(inode, hidden_inode, unionfs_get_nlinks);
        fsstack_copy_inode_size(inode, hidden_inode);
-       
-       if(spliced) 
+
+       if(spliced)
                goto out_spliced;
 skip:
        /* only (our) lookup wants to do a d_add */
@@ -167,7 +167,7 @@ skip:
                /* d_splice can return a dentry if it was disconnected
                 * and had to be moved. We must make sure that the pd
                 * of the new dentry is correct and that the inode info
-                * was filled properly. Finally we must return this new 
+                * was filled properly. Finally we must return this new
                 * dentry
                 */
                else if (spliced && spliced != dentry) {
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to