commit ebd4ccf571b967354f185d71d5346bd6c12576fc
Author: Erez_Zadok <[EMAIL PROTECTED]>
Date:   Mon Jun 11 10:42:28 2007 -0400

    Revert "cleanup: rewrite new_dentry_private data more simply"
    
    This reverts commit db78098f66e2465195e33001788f0981ef788f3a.

diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index 8cb3c10..ec0749b 100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
@@ -428,20 +428,24 @@ int new_dentry_private_data(struct dentry *dentry)
        int size;
        struct unionfs_dentry_info *info = UNIONFS_D(dentry);
        void *p;
+       int unlock_on_err = 0;
 
-       BUG_ON(info);
+       if (!info) {
+               dentry->d_fsdata = kmem_cache_alloc(unionfs_dentry_cachep,
+                                                   GFP_ATOMIC);
+               info = UNIONFS_D(dentry);
+               if (!info)
+                       goto out;
 
-       dentry->d_fsdata = kmem_cache_alloc(unionfs_dentry_cachep,
-                                           GFP_ATOMIC);
-       info = UNIONFS_D(dentry);
-       if (!info)
-               goto out;
+               mutex_init(&info->lock);
+               unionfs_lock_dentry(dentry);
+               unlock_on_err = 1;
 
-       mutex_init(&info->lock);
-       info->lower_paths = NULL;
-       unionfs_lock_dentry(dentry);
+               info->lower_paths = NULL;
+       }
 
-       info->bstart = info->bend = -1;
+       info->bstart = -1;
+       info->bend = -1;
        info->bcount = sbmax(dentry->d_sb);
        info->odf.dentry = NULL;
        atomic_set(&info->generation,
@@ -459,7 +463,10 @@ int new_dentry_private_data(struct dentry *dentry)
        return 0;
 
 out_free:
-       unionfs_unlock_dentry(dentry);
+       kfree(info->lower_paths);
+       if (unlock_on_err)
+               unionfs_unlock_dentry(dentry);
+
 out:
        free_dentry_private_data(info);
        dentry->d_fsdata = NULL;
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to