From: Mehtab Zafar <hello@mzfr.me>
To: Al Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
linux-fsdevel@vger.kernel.org
Cc: Jan Kara <jack@suse.cz>, Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/2] splice: handle zero-count sendfile to full pipes
Date: Sat, 28 Nov 2026 13:42:32 +0000 [thread overview]
Message-ID: <20261128134221.64884-1-hello@mzfr.me> (raw)
[-- Attachment #1: Type: text/plain, Size: 1876 bytes --]
sendfile() sends to a pipe through splice_file_to_pipe() directly. For a
zero-count operation, that helper currently waits for pipe space before the
lower-level read sees the zero length. On a full pipe this makes blocking
sendfile() wait and nonblocking sendfile() return -EAGAIN, while splice()
returns zero immediately.
Patch 1 returns before waiting when the helper receives a zero length.
Patch 2 adds kselftest coverage for full blocking and nonblocking pipes.
This bug was found with AI assistance, which also helped
prepare the fix, tests, and description.
Validation on x86_64, based on vfs/vfs.all at 3857587d9d6f:
- baseline, three fresh no-disk/no-NIC KVM boots: nonblocking returned
-EAGAIN, blocking waited until interrupted, and the selftest passed 0/2
- patched, three fresh no-disk/no-NIC KVM boots: both calls returned zero
immediately and the selftest passed 2/2
- positive-count full-pipe behavior remained -EAGAIN, invalid output fd
remained -EBADF, an
d the input offset and pipe contents did not advance
- W=1 fs/splice.o and full bzImage builds passed
- strict checkpatch was clean for the fix; for the selftest it reported
no errors, warnings, or checks with FILE_PATH_CHANGES ignored. The final
selftest run also logged an spdxcheck.py traceback due to missing Python
ply; unchanged source and SPDX text had passed earlier SPDX validation
Mehtab Zafar (2):
splice: return immediately for zero-length file-to-pipe splices
selftests/splice: cover zero-count sendfile to a full pipe
fs/splice.c | 3 +
tools/testing/selftests/splice/.gitignore | 1 +
tools/testing/selftests/splice/Makefile | 1 +
.../testing/selftests/splice/sendfile_zero.c | 93 +++++++++++++++++++
4 files changed, 98 insertions(+)
create mode 100644 tools/testing/selftests/splice/sendfile_zero.c
--
2.34.1
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 563 bytes --]
next reply other threads:[~2026-11-28 13:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 13:42 Mehtab Zafar [this message]
2026-11-28 13:42 ` [PATCH 1/2] splice: return immediately for zero-length file-to-pipe splices Mehtab Zafar
2026-11-28 13:42 ` [PATCH 2/2] selftests/splice: cover zero-count sendfile to a full pipe Mehtab Zafar
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=20261128134221.64884-1-hello@mzfr.me \
--to=hello@mzfr.me \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®