Re: splicing pages to the same file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 25, 2014 at 8:00 AM, Miklos Szeredi <miklos@xxxxxxxxxx> wrote:
> In pipe_to_file() I noticed the "if (buf->page != page)" and started thinking
> about this.  What should be the correct behavior?

I don't think we can have "correct" behavior, because no such behavior exists.

It's very much like memcpy() with the destination and source
overlapping. And as you noticed, doing it as a "memmove()" in
pipe_to_file() wouldn't help, because since we block this up by pages,
there will still be a potential overlap across subsequent page
fragments.

So I think the only reasonable option is to document the fact that
splicing from a file to itself falls under the "you're insane, it may
or may not do what you want". And since it depends on page size and on
which order we move pages around in etc, the rule should simply be
that you cannot sanely expect a splice from a file to itself to work.
Regardless of any actual byte range overlap details. "Don't do it".

Now, we *could* make it work when there isn't any overlap. Right now,
if you splice from a file to itself within the same page, we'll always
just say "screw you", but we could look at the offset too. That
wouldn't make a true overlap work (you could still have overlap that
we'd miss because within one part of a page it wouldn't look like
overlap to us since we only see this one page fragment at a time), but
we could try to make the case where there is no true overlap always
work reliably.

But would that be it worth it, since older kernels would still not
give those guarantees? Why did you even notice?

                   Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux