On 12/14/23 11:45 AM, Ahelenia Ziemia?ska wrote: > We request non-blocking I/O in the generic implementation, but some > files ? ttys ? only check O_NONBLOCK. Refuse them here, lest we > risk sleeping with the pipe locked for indeterminate lengths of > time. A worthy goal here is ensuring that _everybody_ honors IOCB_NOWAIT, rather than just rely on O_NONBLOCK. This does involve converting to ->read_iter/->write_iter if the driver isn't already using it, but some of them already have that, yet don't check IOCB_NOWAIT or treat it the same as O_NONBLOCK. Adding special checks like this is not a good idea, imho. > This also masks inconsistent wake-ups (usually every second line) > when splicing from ttys in icanon mode. > > Regular files don't /have/ a distinct O_NONBLOCK mode, > because they always behave non-blockingly, and for them FMODE_NOWAIT is > used in the purest sense of > /* File is capable of returning -EAGAIN if I/O will block */ > which is not set by the vast majority of filesystems, > and it's not the semantic we want here. The main file systems do very much set it, like btrfs, ext4, and xfs. If you look at total_file_systems / ones_flagging_it the ratio may be high, but in terms of installed userbase, the majority definitely will have it. Also see comment on cover letter for addressing this IOCB_NOWAIT confusion. -- Jens Axboe