Bug 218320

Summary: splice with SPLICE_F_NONBLOCK returns -1 EAGAIN on writeable pipes
Product: [Fedora] Fedora Reporter: James Antill <james.antill>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED INSUFFICIENT_DATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 6CC: jonstanley, wtogami
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-02-08 04:28:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 427887    
Attachments:
Description Flags
Test splice call and flags. none

Description James Antill 2006-12-04 17:33:17 UTC
Description of problem:
 Although there is no documentation on splice() I assume that SPLICE_F_NONBLOCK
is supposed to be the same as having a nonblocking flag on the pipe ... this
isn't so, with the SPLICE_F_NONBLOCK flag splice() can return -1 EAGAIN when
poll() says the pipe is ready to accept data.
 strace:

poll([{fd=4, events=POLLOUT, revents=POLLOUT}, {fd=6, events=POLLOUT,
revents=POLLOUT}], 2, -1) = 2
SYS_313(0x7, 0, 0x4, 0, 0x3d060000)     = -1 EAGAIN (Resource temporarily
unavailable)
SYS_313(0x9, 0, 0x6, 0, 0x618e000)      = -1 EAGAIN (Resource temporarily
unavailable)

...I've included a test program.
 Note that even if I'm wrong in my assumption of what SPLICE_F_NONBLOCK does,
the only other thing I could imagine is that it is doing a real nonblock on the
page cache too ... and I've included readahead() calls which should "fix" that
(although not having a working poll() would make that definition much less useful).

Version-Release number of selected component (if applicable):
% uname -a                                        ~/glibc-tst-rpms
Linux code.and.org 2.6.18-1.2849.fc6 #1 SMP Fri Nov 10 12:45:28 EST 2006 i686
athlon i386 GNU/Linux

...note that although the syscall is in glibc FC6, it's broken (fixed in
rawhide) if you have a rawhide/test glibc and want to make sure it's not that
just change the LOCAL_SPLICE define -- I've done this in my testing.

How reproducible:
 Always

Additional info:
 See the attached splice test application. Note that if you change
USE_O_NONBLOCK_R from 0 to 1 and USE_SPLICE_NONBLOCK_R from 1 to 0, the test
program will use fcntl() O_NONBLOCK instead of the SPLICE_F_NONBLOCK flag which
does the exected thing.

 Use it like:

./splicetst /tmp/big_1GB /tmp/o1 /tmp/big_100MB /tmp/o2

Comment 1 James Antill 2006-12-04 17:33:18 UTC
Created attachment 142752 [details]
Test splice call and flags.

Comment 2 Jon Stanley 2008-01-08 01:50:49 UTC
(This is a mass-update to all current FC6 kernel bugs in NEW state)

Hello,

I'm reviewing this bug list as part of the kernel bug triage project, an attempt
to isolate current bugs in the Fedora kernel.

http://fedoraproject.org/wiki/KernelBugTriage

I am CC'ing myself to this bug, however this version of Fedora is no longer
maintained.

Please attempt to reproduce this bug with a current version of Fedora (presently
Fedora 8). If the bug no longer exists, please close the bug or I'll do so in a
few days if there is no further information lodged.

Thanks for using Fedora!

Comment 3 Jon Stanley 2008-02-08 04:28:59 UTC
Per the previous comment in this bug, I am closing it as INSUFFICIENT_DATA,
since no information has been lodged for over 30 days.

Please re-open this bug or file a new one if you can provide the requested data,
and thanks for filing the original report!