Skip to content

Commit

Permalink
ovl: Do not do metacopy only for ioctl modifying file attr
Browse files Browse the repository at this point in the history
ovl_copy_up() by default will only do metadata only copy up (if enabled).
That means when ovl_real_ioctl() calls ovl_real_file(), it will still get
the lower file (as ovl_real_file() opens data file and not metacopy).  And
that means "chattr +i" will end up modifying lower inode.

There seem to be two ways to solve this.
A. Open metacopy file in ovl_real_ioctl() and do operations on that
B. Force full copy up when FS_IOC_SETFLAGS is called.

I am resorting to option B for now as it feels little safer option.  If
there are performance issues due to this, we can revisit it.

Signed-off-by: Vivek Goyal <[email protected]>
Reviewed-by: Amir Goldstein <[email protected]>
Signed-off-by: Miklos Szeredi <[email protected]>
  • Loading branch information
rhvgoyal authored and Miklos Szeredi committed Jul 20, 2018
1 parent 997336f commit 935a074
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/overlayfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ static long ovl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
if (ret)
return ret;

ret = ovl_copy_up(file_dentry(file));
ret = ovl_copy_up_with_data(file_dentry(file));
if (!ret) {
ret = ovl_real_ioctl(file, cmd, arg);

Expand Down

0 comments on commit 935a074

Please sign in to comment.