linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Dave Chinner <david@fromorbit.com>
Cc: Ben Myers <bpm@sgi.com>, Peter Zijlstra <peterz@infradead.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Dave Jones <davej@redhat.com>,
	xfs@oss.sgi.com
Subject: Re: splice vs execve lockdep trace.
Date: Tue, 16 Jul 2013 21:54:09 -0700	[thread overview]
Message-ID: <CA+55aFz5xw9Qi9Q6mwoCSud5eQh5u-QZ-xrY+TqgZPoKOgn6ew@mail.gmail.com> (raw)
In-Reply-To: <20130717040616.GI11674@dastard>

On Tue, Jul 16, 2013 at 9:06 PM, Dave Chinner <david@fromorbit.com> wrote:
>
> Right, and that's one of the biggest problems page based IO has - we
> can't serialise it against other IO and other page cache
> manipulation functions like hole punching. What happens when a
> splice read or mmap page fault races with a hole punch? You get
> stale data being left in the page cache because we can't serialise
> the page read with the page cache invalidation and underlying extent
> removal.

But Dave, that's *good*.

You call it "stale data".

I call it "the data was valid at some point".

This is what "splice()" is fundamentally all about.

Think of it this way: even if you are 100% serialized during the
"splice()" operation, what do you think happens afterwards?

Seriously, think it through.

That data is in a kernel buffer - the pipe. The fact that it was
serialized at the time of the original splice() doesn't make _one_
whit of a difference, because after the splice is over, the data still
sits around in that pipe buffer, and you're no longer serializing it.
Somebody else truncating the file or punching a hole in the file DOES
NOT MATTER. It's too late.

In other words, trying to "protect" against that kind of race is stupid.

You're missing the big picture because you're concentrating on the
details. Look beyond what happens inside XFS, and think about the
higher-level meaning of splice() itself.

So the only guarantee splice *should* give is entirely per-page. If
you think it gives any other serialization, you're fundamentally
wrong, because it *cannot*. See?

                     Linus

  reply	other threads:[~2013-07-17  4:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-16  1:53 splice vs execve lockdep trace Dave Jones
2013-07-16  2:32 ` Linus Torvalds
2013-07-16  2:38   ` Dave Jones
2013-07-16  3:25     ` Linus Torvalds
2013-07-16  3:28       ` Dave Jones
2013-07-16  5:31       ` Al Viro
2013-07-16  6:03       ` Dave Chinner
2013-07-16  6:16         ` Al Viro
2013-07-16  6:41           ` Dave Chinner
2013-07-16  6:50           ` Dave Chinner
2013-07-16 19:33         ` Ben Myers
2013-07-16 20:18           ` Linus Torvalds
2013-07-16 20:43             ` Dave Chinner
2013-07-16 21:02               ` Linus Torvalds
2013-07-17  4:06                 ` Dave Chinner
2013-07-17  4:54                   ` Linus Torvalds [this message]
2013-07-17  5:51                     ` Dave Chinner
2013-07-17 16:03                       ` Linus Torvalds
2013-07-17 23:40                         ` Ben Myers
2013-07-18  0:17                           ` Linus Torvalds
2013-07-18  3:42                             ` Dave Chinner
2013-07-18 21:16                               ` Ben Myers
2013-07-18 22:21                                 ` Ben Myers
2013-07-18 22:49                                   ` Dave Chinner
2013-07-18  3:17                         ` Dave Chinner
2013-07-16 13:59       ` Vince Weaver
2013-07-16 15:02         ` Dave Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+55aFz5xw9Qi9Q6mwoCSud5eQh5u-QZ-xrY+TqgZPoKOgn6ew@mail.gmail.com \
    --to=torvalds@linux-foundation.org \
    --cc=bpm@sgi.com \
    --cc=davej@redhat.com \
    --cc=david@fromorbit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).