GIT: unionfs2-2.6.27.y: bug fix: get lower mnt from root dentry instead of lower dentry

Erez Zadok ezk at fsl.cs.sunysb.edu
Thu Aug 12 23:16:28 EDT 2010


commit e393fb08d8d13d0f8abb04ab6442a7802772f69a
Author: Erez_Zadok <ezk at cs.sunysb.edu>
Date:   Mon May 28 19:18:45 2007 -0400

    bug fix: get lower mnt from root dentry instead of lower dentry
    
    While copying-up a file, the union object hasn't been fully formed yet, so
    we don't have all the lower dentries/mnts to use (the caller will have them
    later on).  Therefore, we should use the sb->s_root's lower mnt here.  This
    fixes a "NULL mnt" warning message that came from unionfs_mntget.
    
    Signed-off-by: Erez Zadok <ezk at cs.sunysb.edu>

diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c
index 18203a3..ab9f67a 100644
--- a/fs/unionfs/copyup.c
+++ b/fs/unionfs/copyup.c
@@ -184,6 +184,7 @@ static int __copyup_reg_data(struct dentry *dentry,
 	struct super_block *sb = dentry->d_sb;
 	struct file *input_file;
 	struct file *output_file;
+	struct vfsmount *output_mnt;
 	mm_segment_t old_fs;
 	char *buf = NULL;
 	ssize_t read_bytes, write_bytes;
@@ -211,12 +212,11 @@ static int __copyup_reg_data(struct dentry *dentry,
 
 	/* open new file */
 	dget(new_hidden_dentry);
-	unionfs_mntget(dentry, new_bindex);
+	output_mnt = unionfs_mntget(sb->s_root, new_bindex);
 	unionfs_read_lock(sb);
 	branchget(sb, new_bindex);
 	unionfs_read_unlock(sb);
-	output_file = dentry_open(new_hidden_dentry,
-				  unionfs_lower_mnt_idx(dentry, new_bindex),
+	output_file = dentry_open(new_hidden_dentry, output_mnt,
 				  O_WRONLY | O_LARGEFILE);
 	if (IS_ERR(output_file)) {
 		err = PTR_ERR(output_file);


More information about the unionfs-cvs mailing list