Bug 85381 - ext4 & tmpfs: Splicing to regular files doesn't trigger inotify
Summary: ext4 & tmpfs: Splicing to regular files doesn't trigger inotify
Alias: None
Product: File System
Classification: Unclassified
Component: ext4 (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: fs_ext4@kernel-bugs.osdl.org
Depends on:
Reported: 2014-10-01 16:56 UTC by Richard Li
Modified: 2018-10-11 07:27 UTC (History)
2 users (show)

See Also:
Kernel Version: 3.14
Tree: Mainline
Regression: No


Description Richard Li 2014-10-01 16:56:36 UTC
* How to reproduce:

/tmp % cat a.c
#define _GNU_SOURCE 1
#include <limits.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>

int main(void)
        int pipefd[2];

        for (;;) {
                write(pipefd[1], "Hello world\n", 12);
                splice(pipefd[0], NULL, 1, NULL, INT_MAX, 0);
/tmp % gcc a.c
/tmp % touch a.txt
/tmp % ./a.out > a.txt & tail -f a.txt

* Expected result:

tail prints "Hello world" every second.

* Actual result:

btrfs: Works as expected;
ext4/tmpfs: tail blocks on inotify forever and prints nothing.
Comment 1 Jan Kara 2014-10-02 12:05:01 UTC
So this isn't a problem with current kernel (I tested 3.17-rc5) anymore. I believe it got fixed by Al Viro's splice rewrite so 3.16 and newer kernels should have the problem fixed.
Comment 2 Dario Andreani 2018-10-11 07:27:11 UTC
I still see this issue on kernel versions 4.4 and 4.9. But not on 4.15.

Note You need to log in before you can comment on or make changes to this bug.