Unionfs: bugfix -- set copied up open file mode to read and write
authorErez_Zadok <ezk@cs.sunysb.edu>
Fri, 16 Nov 2007 18:47:09 +0000 (13:47 -0500)
committerRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Thu, 1 May 2008 23:02:57 +0000 (19:02 -0400)
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 <ezk@cs.sunysb.edu>
fs/unionfs/copyup.c

index 3e99a736b6565eece804f19b0c1e879cbc997e80..c8e6e2d57114762e4c1b05f0b0fd909198a973ef 100644 (file)
@@ -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;