Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1529309

Re: [PATCH 4/7] ovl: add infrastructure for intercepting file ops

From Miklos Szeredi <miklos@szeredi.hu>
Newsgroups linux.kernel
Subject Re: [PATCH 4/7] ovl: add infrastructure for intercepting file ops
Date 2016-11-24 15:00 +0100
Message-ID <sH2Jc-3tF-23@gated-at.bofh.it> (permalink)
References <sGZUZ-1zn-13@gated-at.bofh.it> <sGZUZ-1zn-19@gated-at.bofh.it> <sH0R3-27o-19@gated-at.bofh.it> <sH10J-2qN-5@gated-at.bofh.it> <sH26t-3bL-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Nov 24, 2016 at 2:12 PM, Amir Goldstein <amir73il@gmail.com> wrote:
> On Thu, Nov 24, 2016 at 2:03 PM, Miklos Szeredi <miklos@szeredi.hu> wrote:
>> On Thu, Nov 24, 2016 at 12:52 PM, Amir Goldstein <amir73il@gmail.com> wrote:
>>> On Thu, Nov 24, 2016 at 12:55 PM, Miklos Szeredi <mszeredi@redhat.com> wrote:
>>
>>>> +               /*
>>>> +                * These should be intercepted, but they are very unlikely to be
>>>> +                * a problem in practice.  Leave them alone for now.
>>>
>>> It could also be handled in vfs helpers.
>>> Since these ops all start with establishing that src and dest are on
>>> the same sb,
>>> then the cost of copy up of src is the cost of clone_file_range from
>>> lower to upper,
>>> so it is probably worth to copy up src and leave those fops alone.
>>>
>>>> +                */
>>>> +               ofop->fops.copy_file_range = orig->copy_file_range;
>>>> +               ofop->fops.clone_file_range = orig->clone_file_range;
>>>> +               ofop->fops.dedupe_file_range = orig->dedupe_file_range;
>>
>> Not sure I understand.  Why should we copy up src?  Copy up is the
>> problem not the solution.
>>
>
> Maybe the idea is ill conceived, but the reasoning is:
> To avoid the corner case of cloning from a stale lower src,
> call d_real() in vfs helpers to always copy up src before cloning from it
> and pass the correct file onwards.

Which correct file?  src is still the wrong one after calling d_real.
We need to clone-open src, just like we do in ovl_read_iter to get the
correct file.  But then what's the use of copying it up beforehand?

We could move the whole logic into the vfs, but I don't really see the point.

I left these ops alone because there is some confusion in there about
getting the f_op from the source or the destination file.  And while
it doesn't matter normally (all regular files have the same f_op,
regardless of open flags)  it does matter for overlayfs intercept,
because overriding fops in the the dest file would mean additional
complexity and  resources).  That could easily be fixed in the vfs:
calling src->f_ops->foo works equally well, but I simply didn't want
to bother with this.  We can return to it later.

Thanks,
Miklos

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/7] overlayfs: fix ro/rw fd data inconsistecies Miklos Szeredi <mszeredi@redhat.com> - 2016-11-24 12:00 +0100
  [PATCH 0/7] overlayfs: fix ro/rw fd data inconsistecies Miklos Szeredi <mszeredi@redhat.com> - 2016-11-24 12:00 +0100
    Re: [PATCH 0/7] overlayfs: fix ro/rw fd data inconsistecies Miklos Szeredi <miklos@szeredi.hu> - 2016-11-24 15:20 +0100
      Re: [PATCH 0/7] overlayfs: fix ro/rw fd data inconsistecies Amir Goldstein <amir73il@gmail.com> - 2016-11-24 22:00 +0100
  [PATCH 3/7] mm: ovl: copy-up on MAP_SHARED Miklos Szeredi <mszeredi@redhat.com> - 2016-11-24 12:00 +0100
  [PATCH 4/7] ovl: add infrastructure for intercepting file ops Miklos Szeredi <mszeredi@redhat.com> - 2016-11-24 12:00 +0100
    Re: [PATCH 4/7] ovl: add infrastructure for intercepting file ops Amir Goldstein <amir73il@gmail.com> - 2016-11-24 13:00 +0100
      Re: [PATCH 4/7] ovl: add infrastructure for intercepting file ops Miklos Szeredi <miklos@szeredi.hu> - 2016-11-24 13:10 +0100
        Re: [PATCH 4/7] ovl: add infrastructure for intercepting file ops Amir Goldstein <amir73il@gmail.com> - 2016-11-24 14:20 +0100
          Re: [PATCH 4/7] ovl: add infrastructure for intercepting file ops Miklos Szeredi <miklos@szeredi.hu> - 2016-11-24 15:00 +0100
            Re: [PATCH 4/7] ovl: add infrastructure for intercepting file ops Amir Goldstein <amir73il@gmail.com> - 2016-11-24 15:10 +0100
              Re: [PATCH 4/7] ovl: add infrastructure for intercepting file ops Amir Goldstein <amir73il@gmail.com> - 2016-11-25 06:30 +0100
  [PATCH 5/7] ovl: intercept read_iter Miklos Szeredi <mszeredi@redhat.com> - 2016-11-24 12:00 +0100
  [PATCH 1/7] vfs: allow overlayfs to intercept file ops Miklos Szeredi <mszeredi@redhat.com> - 2016-11-24 12:00 +0100
  [PATCH 6/7] ovl: intercept mmap Miklos Szeredi <mszeredi@redhat.com> - 2016-11-24 12:10 +0100
    Re: [PATCH 6/7] ovl: intercept mmap Amir Goldstein <amir73il@gmail.com> - 2016-11-24 14:30 +0100
      Re: [PATCH 6/7] ovl: intercept mmap Amir Goldstein <amir73il@gmail.com> - 2016-11-24 19:10 +0100
        Re: [PATCH 6/7] ovl: intercept mmap Amir Goldstein <amir73il@gmail.com> - 2016-11-24 20:10 +0100
  [PATCH 2/7] vfs: export filp_clone_open() Miklos Szeredi <mszeredi@redhat.com> - 2016-11-24 12:10 +0100
  [PATCH 7/7] ovl: intercept fsync Miklos Szeredi <mszeredi@redhat.com> - 2016-11-24 12:10 +0100

csiph-web