Before, we used to copyup on an open(2) call which used flags implying
writing (O_RDWR, O_WRONLY, O_APPEND). This meant that a file being opened
for writing, then immediately closed (without actually writing to the file),
will still have been copied up. Now, we don't copyup such files in ->open,
but defer the copyup till later. [Bug #591].
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
* This is important for open-but-unlinked files, as well as mmap
* support.
*/
- err = unionfs_file_revalidate(file, true);
+ err = unionfs_file_revalidate(file, UNIONFS_F(file)->wrote_to_file);
if (unlikely(err))
goto out;
unionfs_check_file(file);
unionfs_read_lock(dentry->d_sb, UNIONFS_SMUTEX_PARENT);
unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
- err = unionfs_file_revalidate(file, true);
+ err = unionfs_file_revalidate(file, UNIONFS_F(file)->wrote_to_file);
if (unlikely(err))
goto out;
unionfs_check_file(file);
lower_file->f_path.dentry->d_inode);
fsstack_copy_attr_times(dentry->d_inode,
lower_file->f_path.dentry->d_inode);
+ UNIONFS_F(file)->wrote_to_file = true; /* for delayed copyup */
unionfs_check_file(file);
}
struct file **lower_files;
int *saved_branch_ids; /* IDs of branches when file was opened */
struct vm_operations_struct *lower_vm_ops;
+ bool wrote_to_file; /* for delayed copyup */
};
/* unionfs inode data in memory */