# 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/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc --version # < /opt/cross/kisskb/gcc-4.6.3-nolibc/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-ld --version # < git log --format=%s --max-count=1 ee5e001196d1345b8fee25925ff5f1d67936081e # < make -s -j 10 ARCH=arm O=/kisskb/build/linus_em_x270_defconfig_arm CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi- em_x270_defconfig # make -s -j 10 ARCH=arm O=/kisskb/build/linus_em_x270_defconfig_arm CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi- /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/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/net/ipv4/ip_output.c: In function '__ip_append_data': /kisskb/src/include/linux/skbuff.h:1338:6: warning: 'extra_uref' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/net/ipv4/ip_output.c:885:14: note: 'extra_uref' was declared here /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] Completed OK # rm -rf /kisskb/build/linus_em_x270_defconfig_arm # Build took: 0:00:51.383170