# 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/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux-gcc --version # < /opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux-ld --version # < git log --format=%s --max-count=1 ee5e001196d1345b8fee25925ff5f1d67936081e # < make -s -j 8 ARCH=powerpc O=/kisskb/build/linus_corenet64_smp_defconfig_powerpc-gcc4.6 CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux- corenet64_smp_defconfig # make -s -j 8 ARCH=powerpc O=/kisskb/build/linus_corenet64_smp_defconfig_powerpc-gcc4.6 CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux- /kisskb/src/kernel/cgroup/cgroup-v1.c: In function 'cgroup1_mount': /kisskb/src/kernel/cgroup/cgroup-v1.c:1288:1: warning: 'root' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/kernel/cgroup/cgroup-v1.c:1120:22: note: 'root' was declared here /kisskb/src/kernel/printk/printk.c: In function 'devkmsg_sysctl_set_loglvl': /kisskb/src/kernel/printk/printk.c:186:16: warning: 'old' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/kernel/trace/trace_dynevent.c: In function 'create_dyn_event': /kisskb/src/kernel/trace/trace_dynevent.c:89:5: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/mm/hugetlb.c: In function 'alloc_pool_huge_page': /kisskb/src/mm/hugetlb.c:1434:5: warning: 'page' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/base/regmap/regmap.c: In function 'regmap_raw_read': /kisskb/src/drivers/base/regmap/regmap.c:2594:6: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/base/regmap/regmap.c: In function '_regmap_raw_write': /kisskb/src/drivers/base/regmap/regmap.c:1855:6: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/proc/inode.c: In function 'proc_reg_open': /kisskb/src/include/linux/list.h:65:12: warning: 'pdeo' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/proc/inode.c:339:21: note: 'pdeo' was declared here /kisskb/src/fs/udf/unicode.c: In function 'udf_name_conv_char': /kisskb/src/fs/udf/unicode.c:132:8: warning: 'c' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/i2c/i2c-core-base.c: In function 'i2c_generic_scl_recovery': /kisskb/src/drivers/i2c/i2c-core-base.c:235:5: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/tty/serial/8250/8250_core.c: In function 'univ8250_release_irq': /kisskb/src/drivers/tty/serial/8250/8250_core.c:247:18: warning: 'i' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/tty/serial/8250/8250_core.c:227:19: note: 'i' was declared here WARNING: vmlinux.o (.PPC.EMB.apuinfo): unexpected non-allocatable section. Did you forget to use "ax"/"aw" in a .S file? Note that for example contains section definitions for use in .S files. INFO: Uncompressed kernel (size 0xf67d00) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0x1000000) Image Name: Linux-5.0.0-gee5e001196d1 Created: Tue Mar 5 15:01:31 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6505369 Bytes = 6352.90 KiB = 6.20 MiB Load Address: 00000000 Entry Point: 00000000 Completed OK # rm -rf /kisskb/build/linus_corenet64_smp_defconfig_powerpc-gcc4.6 # Build took: 0:02:23.485974