bug fix: get lower mnt from root dentry instead of lower dentry
authorErez_Zadok <ezk@cs.sunysb.edu>
Mon, 28 May 2007 23:18:45 +0000 (19:18 -0400)
committerErez_Zadok <ezk@cs.sunysb.edu>
Mon, 23 Jul 2007 00:50:45 +0000 (20:50 -0400)
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@cs.sunysb.edu>
fs/unionfs/copyup.c

index 18203a33994c638c9e0a773740435ceec9210b20..ab9f67ada70a5844b0f068e2e99987258df47b8c 100644 (file)
@@ -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);