mmap: also revalidate file passed to unionfs_release
authorErez_Zadok <ezk@cs.sunysb.edu>
Sat, 19 May 2007 23:17:30 +0000 (19:17 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Tue, 11 Nov 2014 02:32:57 +0000 (21:32 -0500)
Conflicts:

fs/unionfs/commonfops.c

fs/unionfs/commonfops.c

index fd2e546ccfe4b8b6bf7acb6c49eade9b39e03ea7..b0ec71b03b0180b24fa27ca69580e409c2684acf 100644 (file)
@@ -603,12 +603,19 @@ out_nofree:
 int unionfs_file_release(struct inode *inode, struct file *file)
 {
        struct file *hidden_file = NULL;
-       struct unionfs_file_info *fileinfo = UNIONFS_F(file);
-       struct unionfs_inode_info *inodeinfo = UNIONFS_I(inode);
+       struct unionfs_file_info *fileinfo;
+       struct unionfs_inode_info *inodeinfo;
        struct super_block *sb = inode->i_sb;
        int bindex, bstart, bend;
        int fgen, err = 0;
 
+       unionfs_read_lock(sb);
+       if ((err = unionfs_file_revalidate(file, 1)))
+               goto out;
+       fileinfo = UNIONFS_F(file);
+       BUG_ON(file->f_dentry->d_inode != inode);
+       inodeinfo = UNIONFS_I(inode);
+
        unionfs_check_file(file);
        unionfs_read_lock(sb);
        /*
@@ -618,6 +625,7 @@ int unionfs_file_release(struct inode *inode, struct file *file)
         */
        if ((err = unionfs_file_revalidate(file, 1)))
                goto out;
+
        /* fput all the hidden files */
        fgen = atomic_read(&fileinfo->generation);
        bstart = fbstart(file);