GIT: unionfs2-2.6.27.y: Unionfs: Cleanup locking in new_dentry_private_data
Erez Zadok
ezk at fsl.cs.sunysb.edu
Thu Aug 12 23:16:26 EDT 2010
commit 9e59a509c513d43b0fb2c8a109b100acf3384ad4
Author: Erez_Zadok <ezk at cs.sunysb.edu>
Date: Fri May 25 15:45:30 2007 -0400
Unionfs: Cleanup locking in new_dentry_private_data
Signed-off-by: Josef 'Jeff' Sipek <jsipek at cs.sunysb.edu>
Conflicts:
fs/unionfs/lookup.c
diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index 4dec675..0593f56 100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
@@ -464,23 +464,18 @@ 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;
- spin_lock(&dentry->d_lock);
if (!info) {
- dentry->d_fsdata = kmem_cache_alloc(unionfs_dentry_cachep,
- GFP_ATOMIC);
- info = UNIONFS_D(dentry);
+ info = kmem_cache_alloc(unionfs_dentry_cachep, GFP_ATOMIC);
if (!info)
goto out;
mutex_init(&info->lock);
- unionfs_lock_dentry(dentry);
- unlock_on_err = 1;
-
info->lower_paths = NULL;
}
+ mutex_lock(&info->lock);
+
info->bstart = -1;
info->bend = -1;
info->bopaque = -1;
@@ -497,18 +492,17 @@ int new_dentry_private_data(struct dentry *dentry)
info->lower_paths = p;
memset(info->lower_paths, 0, size);
- spin_unlock(&dentry->d_lock);
+ /* ok, set the dentry private data pointer */
+ dentry->d_fsdata = info;
return 0;
out_free:
kfree(info->lower_paths);
- if (unlock_on_err)
- unionfs_unlock_dentry(dentry);
+ mutex_unlock(&info->lock);
out:
free_dentry_private_data(info);
dentry->d_fsdata = NULL;
- spin_unlock(&dentry->d_lock);
return -ENOMEM;
}
More information about the unionfs-cvs
mailing list