From: Jan Kasprzak <kas@informatics.muni.cz>
To: Andi Kleen <ak@suse.de>
Cc: "David S. Miller" <davem@redhat.com>,
pavel@janik.cz, linux-kernel@vger.kernel.org
Subject: Re: Possible problem with zero-copy TCP and sendfile()
Date: Tue, 17 Apr 2001 19:40:19 +0200 [thread overview]
Message-ID: <20010417194019.A2167@informatics.muni.cz> (raw)
In-Reply-To: <20010417151007.F916@informatics.muni.cz> <20010417164103.A9515@gruyere.muc.suse.de> <20010417175003.D2589096@informatics.muni.cz> <20010417175916.A11824@gruyere.muc.suse.de> <20010417190748.A2591015@informatics.muni.cz>
In-Reply-To: <20010417190748.A2591015@informatics.muni.cz>; from kas@informatics.muni.cz on Tue, Apr 17, 2001 at 07:07:48PM +0200
Jan Kasprzak wrote:
: $ cmp -cl seawolf-sendfile.iso seawolf-i386-SRPMS.iso
[...]
:
: Which simply means, that at 160628609 it started to send
: the CD image from the beginning.
Well, I did strace of proftpd, and it _may_ be a mis-interpretation
of the sendfile(2) semantics on the proftpd side. The relevant part
of strace follows:
gettimeofday({987527927, 46167}, NULL) = 0
fcntl64(12, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl64(12, F_SETFL, O_RDWR) = 0
sendfile(12, 9, [0], 678244352) = 138133872
--- SIGALRM (Alarm clock) ---
rt_sigaction(SIGALRM, {0x804f520, [], SA_INTERRUPT|0x4000000}, NULL, 8) = 0
rt_sigaction(SIGALRM, NULL, {0x804f520, [], SA_INTERRUPT|0x4000000}, 8) = 0
rt_sigaction(SIGALRM, {0x804f520, [], SA_INTERRUPT|0x4000000}, NULL, 8) = 0
alarm(300) = 0
sigreturn() = ? (mask now [])
fcntl64(12, F_SETFL, O_RDWR|O_NONBLOCK) = 0
alarm(0) = 300
alarm(300) = 0
alarm(0) = 300
alarm(300) = 0
getpid() = 24482
geteuid32() = 14
getegid32() = 50
flock(6, LOCK_EX) = 0
lseek(6, 644, SEEK_SET) = 644
read(6, "\242_\0\0\16\0\0\0002\0\0\0\0\0\0\0I\10\0\0\0\0\0\0ftp"..., 644) = 644
lseek(6, 644, SEEK_SET) = 644
write(6, "\242_\0\0\16\0\0\0002\0\0\0\0\0\0\0I\10\0\0\0\0\0\0ftp"..., 644) = 644
flock(6, LOCK_UN) = 0
fcntl64(12, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl64(12, F_SETFL, O_RDWR) = 0
sendfile(12, 9, [0], 540110480) = 103469424
Now the fd 6 is the control connection, fd 9 is the file on disk,
and fd 12 is the data connection. The ProFTPd seems to set alarm to 300
seconds (to detect stalled clients), but when interrupted, something strange
happens: either sendfile does not update the offset in its third parameter,
or it fails to update the offset in the filedescriptor, or something like that.
Maybe ProFTPd should pass the non-zero value (actual offset?) to sendfile()
second time?
What is the expected semantics of sendfile() wrt. restarting
transfers and being interrupted by SIGALRM?
-Yenya
--
\ Jan "Yenya" Kasprzak <kas at fi.muni.cz> http://www.fi.muni.cz/~kas/
\\ PGP: finger kas at aisa.fi.muni.cz 0D99A7FB206605D7 8B35FCDE05B18A5E //
\\\ Czech Linux Homepage: http://www.linux.cz/ ///
Mantra: "everything is a stream of bytes". Repeat until enlightened. --Linus
next prev parent reply other threads:[~2001-04-17 17:40 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 [this message]
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
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=20010417194019.A2167@informatics.muni.cz \
--to=kas@informatics.muni.cz \
--cc=ak@suse.de \
--cc=davem@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@janik.cz \
/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