# git rev-parse -q --verify ee5e001196d1345b8fee25925ff5f1d67936081e^{commit} ee5e001196d1345b8fee25925ff5f1d67936081e already have revision, skipping fetch # git checkout -q -f -B kisskb ee5e001196d1345b8fee25925ff5f1d67936081e # git clean -qxdf # < git log -1 # commit ee5e001196d1345b8fee25925ff5f1d67936081e # Author: Slavomir Kaslev # Date: Thu Feb 7 17:45:19 2019 +0200 # # fs: Make splice() and tee() take into account O_NONBLOCK flag on pipes # # The current implementation of splice() and tee() ignores O_NONBLOCK set # on pipe file descriptors and checks only the SPLICE_F_NONBLOCK flag for # blocking on pipe arguments. This is inconsistent since splice()-ing # from/to non-pipe file descriptors does take O_NONBLOCK into # consideration. # # Fix this by promoting O_NONBLOCK, when set on a pipe, to # SPLICE_F_NONBLOCK. # # Some context for how the current implementation of splice() leads to # inconsistent behavior. In the ongoing work[1] to add VM tracing # capability to trace-cmd we stream tracing data over named FIFOs or # vsockets from guests back to the host. # # When we receive SIGINT from user to stop tracing, we set O_NONBLOCK on # the input file descriptor and set SPLICE_F_NONBLOCK for the next call to # splice(). If splice() was blocked waiting on data from the input FIFO, # after SIGINT splice() restarts with the same arguments (no # SPLICE_F_NONBLOCK) and blocks again instead of returning -EAGAIN when no # data is available. # # This differs from the splice() behavior when reading from a vsocket or # when we're doing a traditional read()/write() loop (trace-cmd's # --nosplice argument). # # With this patch applied we get the same behavior in all situations after # setting O_NONBLOCK which also matches the behavior of doing a # read()/write() loop instead of splice(). # # This change does have potential of breaking users who don't expect # EAGAIN from splice() when SPLICE_F_NONBLOCK is not set. OTOH programs # that set O_NONBLOCK and don't anticipate EAGAIN are arguably buggy[2]. # # [1] https://github.com/skaslev/trace-cmd/tree/vsock # [2] https://github.com/torvalds/linux/blob/d47e3da1759230e394096fd742aad423c291ba48/fs/read_write.c#L1425 # # Signed-off-by: Slavomir Kaslev # Reviewed-by: Steven Rostedt (VMware) # Signed-off-by: Linus Torvalds # < /opt/cross/kisskb/korg/gcc-8.1.0-nolibc/mips-linux/bin/mips-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-8.1.0-nolibc/mips-linux/bin/mips-linux-ld --version # < git log --format=%s --max-count=1 ee5e001196d1345b8fee25925ff5f1d67936081e # < make -s -j 8 ARCH=mips O=/kisskb/build/linus_mips-defconfig_mips-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/mips-linux/bin/mips-linux- defconfig # make -s -j 8 ARCH=mips O=/kisskb/build/linus_mips-defconfig_mips-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/mips-linux/bin/mips-linux- FIT description: Linux 5.0.0-gee5e001196d1 Created: Tue Mar 5 15:37:22 2019 Image 0 (kernel@0) Description: Linux 5.0.0-gee5e001196d1 Created: Tue Mar 5 15:37:22 2019 Type: Kernel Image Compression: gzip compressed Data Size: 4490647 Bytes = 4385.40 KiB = 4.28 MiB Architecture: MIPS OS: Linux Load Address: 0x80100000 Entry Point: 0x808561f0 Hash algo: sha1 Hash value: c5fc16bd569a25b213f4c4cc07546b10c5265480 Image 1 (fdt@boston) Description: img,boston Device Tree Created: Tue Mar 5 15:37:22 2019 Type: Flat Device Tree Compression: uncompressed Data Size: 3793 Bytes = 3.70 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 4799f50d688573234da6e9d7701234d394759ef4 Image 2 (fdt@ni169445) Description: NI 169445 device tree Created: Tue Mar 5 15:37:22 2019 Type: Flat Device Tree Compression: uncompressed Data Size: 1871 Bytes = 1.83 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 51b89b31605ee62038c8468c429af091dfc75ec7 Image 3 (fdt@xilfpga) Description: MIPSfpga (xilfpga) Device Tree Created: Tue Mar 5 15:37:22 2019 Type: Flat Device Tree Compression: uncompressed Data Size: 2708 Bytes = 2.64 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 63d058b780f65e22da30f0a183433765f1807f1d Default Configuration: 'conf@default' Configuration 0 (conf@default) Description: Generic Linux kernel Kernel: kernel@0 Configuration 1 (conf@boston) Description: Boston Linux kernel Kernel: kernel@0 FDT: fdt@boston Configuration 2 (conf@ni169445) Description: NI 169445 Linux Kernel Kernel: kernel@0 FDT: fdt@ni169445 Configuration 3 (conf@xilfpga) Description: MIPSfpga Linux kernel Kernel: kernel@0 FDT: fdt@xilfpga Completed OK # rm -rf /kisskb/build/linus_mips-defconfig_mips-gcc8 # Build took: 0:02:28.668276