Revert "Unionfs: Cleanup locking in new_dentry_private_data"
authorErez_Zadok <ezk@cs.sunysb.edu>
Thu, 31 May 2007 03:34:23 +0000 (23:34 -0400)
committerErez_Zadok <ezk@cs.sunysb.edu>
Mon, 23 Jul 2007 00:50:47 +0000 (20:50 -0400)
This reverts commit ad2d6a5f5e0501ecf704bf2c748e9818ee8e019b.

Conflicts:

fs/unionfs/lookup.c

fs/unionfs/lookup.c

index 5c2334e6e358e53d44d7f960ed2da8bad0b43fec..10339a4a76074e42eb3b4c58de39b7cb2e292cca 100644 (file)
@@ -482,13 +482,19 @@ 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;
 
        if (!info) {
-               info = kmem_cache_alloc(unionfs_dentry_cachep, GFP_ATOMIC);
+               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;
+
                info->lower_paths = NULL;
        }
 
@@ -508,13 +514,12 @@ int new_dentry_private_data(struct dentry *dentry)
        info->lower_paths = p;
        memset(info->lower_paths, 0, size);
 
-       /* ok, set the dentry private data pointer */
-       dentry->d_fsdata = info;
        return 0;
 
 out_free:
        kfree(info->lower_paths);
-       mutex_unlock(&info->lock);
+       if (unlock_on_err)
+               unionfs_unlock_dentry(dentry);
 
 out:
        free_dentry_private_data(info);