lkml.org 
[lkml]   [2018]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 27/28] ovl: Do not do metacopy only for ioctl modifying file attr
    Date
    From: Vivek Goyal <vgoyal@redhat.com>

    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 <vgoyal@redhat.com>
    Reviewed-by: Amir Goldstein <amir73il@gmail.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    ---
    fs/overlayfs/file.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
    index 953295774471..31f32fc1004b 100644
    --- a/fs/overlayfs/file.c
    +++ b/fs/overlayfs/file.c
    @@ -389,7 +389,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);

    --
    2.14.3
    \
     
     \ /
      Last update: 2018-05-29 16:49    [W:4.074 / U:0.056 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site