From 623102d69fb45f0ea55f147fce23c406ba2292ff Mon Sep 17 00:00:00 2001 From: Erez_Zadok Date: Sat, 14 Jul 2007 03:25:02 -0400 Subject: [PATCH] Unionfs: bugfix -- set copied up open file mode to read and write When we copyup a file, we used to set the new file's open mode to write only. But we need read permission too. We need write permission because we're creating a new file; and we need read permission because the original file had to have been readable. If we don't set the new files permission to BOTH read and write, we get -EBADF when trying calling vfs_read/vfs_write on a copied up file. (This fix is somewhat related to unionfs_readpage fixes that use vfs_read instead of calling the lower readpage.) Signed-off-by: Erez Zadok --- fs/unionfs/copyup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c index 09d3bd441f0..eb5d5a0d502 100644 --- a/fs/unionfs/copyup.c +++ b/fs/unionfs/copyup.c @@ -230,7 +230,7 @@ static int __copyup_reg_data(struct dentry *dentry, output_mnt = unionfs_mntget(sb->s_root, new_bindex); branchget(sb, new_bindex); output_file = dentry_open(new_lower_dentry, output_mnt, - O_WRONLY | O_LARGEFILE); + O_RDWR | O_LARGEFILE); if (IS_ERR(output_file)) { err = PTR_ERR(output_file); goto out_close_in2; -- 2.43.0