From: Erez_Zadok Date: Thu, 31 May 2007 03:34:23 +0000 (-0400) Subject: Revert "Unionfs: Cleanup locking in new_dentry_private_data" X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=de1885b6443cdbb3bdcca6ce1de954858970111f;p=unionfs-3.4.y.git Revert "Unionfs: Cleanup locking in new_dentry_private_data" This reverts commit ad2d6a5f5e0501ecf704bf2c748e9818ee8e019b. Conflicts: fs/unionfs/lookup.c --- diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c index 5c2334e6e358..10339a4a7607 100644 --- a/fs/unionfs/lookup.c +++ b/fs/unionfs/lookup.c @@ -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);