public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesse S Sipprell <jss@inflicted.net>
To: "David S. Miller" <davem@redhat.com>
Cc: Jesse S Sipprell <jss@inflicted.net>,
	Jan Kasprzak <kas@informatics.muni.cz>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	linux-kernel@vger.kernel.org
Subject: Re: Possible problem with zero-copy TCP and sendfile()
Date: Tue, 17 Apr 2001 16:44:07 -0400	[thread overview]
Message-ID: <20010417164407.B21620@bastard.inflicted.net> (raw)
In-Reply-To: <20010417170206.C2589096@informatics.muni.cz> <E14pXxg-0002cI-00@the-village.bc.nu> <20010417181524.E2589096@informatics.muni.cz> <20010417161036.A21620@bastard.inflicted.net> <15068.42539.768756.883953@pizda.ninka.net>
In-Reply-To: <15068.42539.768756.883953@pizda.ninka.net>; from davem@redhat.com on Tue, Apr 17, 2001 at 01:23:07PM -0700

On Tue, Apr 17, 2001 at 01:23:07PM -0700, David S. Miller wrote:

> One more subtle note, for the case of error handling.  There is a
> change to sendfile() in the zerocopy patches which causes sendfile()
> to act more like sendmsg() when errors occur.

How is this likely to affect applications?

Currently, the glibc2.1 sendfile interface looks like:

ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count);

On error, -1 is returned in the usual fashion and offset is purported to be
updated to point to the next byte following the last one sent.

Will the zerocopy patches break this?

> 
> Specifically, sendmsg() works roughly like the following when an
> error happens:
> 
> handle_error:
> 	if (sent_something)
> 		return how_much_we_sent;
> 	else
> 		return ERROR_CODE;
> 
> So when an error happens, and the kernel was able to send some of
> the data, you see something like this in the trace:
> 
> 	sendmsg() = N
> 	...
> 	sendmsg() = ERROR_CODE
> 
> sendfile() used to act differently, and this made it difficult to
> directly transform a sendmsg()+local_buffer based server into a
> sendfile() one because the error handling was so different.
> 
> Previously, sendfile() wouldn't give you the partial transfer length,
> you'd just get the error _regardless_ of whether any data was sent
> successfully during that call.  Alexey, myself, and others considered
> this behavior bogus and inconsistent.  So it was changed.
> 
> The long and short of it is that sendfile() now acts just like
> sendmsg() when errors happen mid-send.
> 
> Later,
> David S. Miller
> davem@redhat.com

-- 
"In the event of a failure, the system can be configured to automatically
restart itself.  This feature of Windows NT Server provides maximum system
up-time."  -- Reliability and Fault Tolerance in Windows NT Server, MSC

  reply	other threads:[~2001-04-17 20:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-17 13:10 Possible problem with zero-copy TCP and sendfile() Jan Kasprzak
2001-04-17 14:41 ` Andi Kleen
2001-04-17 15:50   ` Jan Kasprzak
     [not found]     ` <20010417175916.A11824@gruyere.muc.suse.de>
2001-04-17 17:07       ` Jan Kasprzak
2001-04-17 17:40         ` Jan Kasprzak
2001-04-17 14:48 ` Alan Cox
2001-04-17 15:02   ` Jan Kasprzak
2001-04-17 16:04     ` Alan Cox
2001-04-17 16:15       ` Jan Kasprzak
2001-04-17 18:24         ` Pekka Pietikainen
2001-04-17 20:10         ` Jesse S Sipprell
2001-04-17 20:23           ` David S. Miller
2001-04-17 20:44             ` Jesse S Sipprell [this message]
2001-04-17 20:50               ` David S. Miller
2001-04-17 20:36           ` Jan Kasprzak
2001-04-17 21:22             ` Wolfgang Rohdewald
2001-04-17 21:43               ` Martin Josefsson
2001-04-18  6:09               ` Jan Kasprzak

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=20010417164407.B21620@bastard.inflicted.net \
    --to=jss@inflicted.net \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=davem@redhat.com \
    --cc=kas@informatics.muni.cz \
    --cc=linux-kernel@vger.kernel.org \
    /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