GIT: unionfs2-2.6.27.y: Unionfs: unlock lower parent inode correctly on error path
Erez Zadok
ezk at fsl.cs.sunysb.edu
Thu Aug 12 23:18:15 EDT 2010
commit 1fc24d63450f94708c8d3027bd90c152066df5ea
Author: Erez Zadok <ezk at cs.sunysb.edu>
Date: Thu Dec 3 19:00:56 2009 -0500
Unionfs: unlock lower parent inode correctly on error path
Bug fix: on some errors, lower directory inode may remain locked and hold a
reference. This was in ->create, ->symlink, and ->mknod.
Signed-off-by: Erez Zadok <ezk at cs.sunysb.edu>
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index bd5a3b3..0855cdb 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -125,12 +125,12 @@ static int unionfs_create(struct inode *dir, struct dentry *dentry,
lower_parent_dentry = lock_parent(lower_dentry);
if (IS_ERR(lower_parent_dentry)) {
err = PTR_ERR(lower_parent_dentry);
- goto out;
+ goto out_unlock;
}
err = init_lower_nd(&lower_nd, LOOKUP_CREATE);
if (unlikely(err < 0))
- goto out;
+ goto out_unlock;
err = vfs_create(lower_parent_dentry->d_inode, lower_dentry, mode,
&lower_nd);
release_lower_nd(&lower_nd, err);
@@ -146,8 +146,8 @@ static int unionfs_create(struct inode *dir, struct dentry *dentry,
}
}
+out_unlock:
unlock_dir(lower_parent_dentry);
-
out:
if (!err) {
unionfs_postcopyup_setmnt(dentry);
@@ -390,7 +390,7 @@ static int unionfs_symlink(struct inode *dir, struct dentry *dentry,
lower_parent_dentry = lock_parent(lower_dentry);
if (IS_ERR(lower_parent_dentry)) {
err = PTR_ERR(lower_parent_dentry);
- goto out;
+ goto out_unlock;
}
mode = S_IALLUGO;
@@ -406,8 +406,8 @@ static int unionfs_symlink(struct inode *dir, struct dentry *dentry,
}
}
+out_unlock:
unlock_dir(lower_parent_dentry);
-
out:
dput(wh_dentry);
kfree(name);
@@ -583,7 +583,7 @@ static int unionfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
lower_parent_dentry = lock_parent(lower_dentry);
if (IS_ERR(lower_parent_dentry)) {
err = PTR_ERR(lower_parent_dentry);
- goto out;
+ goto out_unlock;
}
err = vfs_mknod(lower_parent_dentry->d_inode, lower_dentry, mode, dev);
@@ -598,8 +598,8 @@ static int unionfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
}
}
+out_unlock:
unlock_dir(lower_parent_dentry);
-
out:
dput(wh_dentry);
kfree(name);
More information about the unionfs-cvs
mailing list