All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: "Ahelenia Ziemiańska" <nabijaczleweli@nabijaczleweli.xyz>
Cc: Christian Brauner <brauner@kernel.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RERESEND 10/11] splice: file->pipe: -EINVAL for non-regular files w/o FMODE_NOWAIT
Date: Fri, 15 Dec 2023 08:47:15 -0700	[thread overview]
Message-ID: <107ff087-92de-4be5-a205-610376d41d72@kernel.dk> (raw)
In-Reply-To: <25974c79b84c0b3aad566ff7c33b082f90ac5f17e.1697486714.git.nabijaczleweli@nabijaczleweli.xyz>

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


  reply	other threads:[~2023-12-15 15:47 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14 18:44 [PATCH RERESEND 00/11] splice(file<>pipe) I/O on file as-if O_NONBLOCK Ahelenia Ziemiańska
2023-12-14 18:44 ` Ahelenia Ziemiańska
2023-12-14 18:44 ` [PATCH RERESEND 01/11] splice: copy_splice_read: do the I/O with IOCB_NOWAIT Ahelenia Ziemiańska
2023-12-14 18:44   ` Ahelenia Ziemiańska
2023-12-14 18:44 ` [PATCH RERESEND 02/11] af_unix: unix_stream_splice_read: always request MSG_DONTWAIT Ahelenia Ziemiańska
2023-12-14 18:44   ` Ahelenia Ziemiańska
2023-12-14 18:44 ` [PATCH RERESEND 03/11] fuse: fuse_dev_splice_read: use nonblocking I/O Ahelenia Ziemiańska
2023-12-14 18:44   ` Ahelenia Ziemiańska
2023-12-14 18:45 ` [PATCH RERESEND 04/11] tracing: tracing_buffers_splice_read: behave as-if non-blocking I/O Ahelenia Ziemiańska
2023-12-14 18:45   ` Ahelenia Ziemiańska
2023-12-20 16:41   ` Steven Rostedt
2023-12-14 18:45 ` [PATCH RERESEND 05/11] relayfs: relay_file_splice_read: always return -EAGAIN for no data Ahelenia Ziemiańska
2023-12-14 18:45   ` Ahelenia Ziemiańska
2023-12-14 18:45 ` [PATCH RERESEND 06/11] net/smc: smc_splice_read: always request MSG_DONTWAIT Ahelenia Ziemiańska
2023-12-14 18:45   ` Ahelenia Ziemiańska
2023-12-14 18:45 ` [PATCH RERESEND 07/11] kcm: kcm_splice_read: " Ahelenia Ziemiańska
2023-12-14 18:45   ` Ahelenia Ziemiańska
2023-12-14 18:45 ` [PATCH RERESEND 08/11] tls/sw: tls_sw_splice_read: always request non-blocking I/O Ahelenia Ziemiańska
2023-12-14 18:45   ` Ahelenia Ziemiańska
2023-12-14 18:45 ` [PATCH RERESEND 09/11] net/tcp: tcp_splice_read: always do non-blocking reads Ahelenia Ziemiańska
2023-12-14 18:45   ` Ahelenia Ziemiańska
2023-12-14 18:45 ` [PATCH RERESEND 10/11] splice: file->pipe: -EINVAL for non-regular files w/o FMODE_NOWAIT Ahelenia Ziemiańska
2023-12-14 18:45   ` Ahelenia Ziemiańska
2023-12-15 15:47   ` Jens Axboe [this message]
2023-12-16  5:36     ` Ahelenia Ziemiańska
2023-12-14 18:45 ` [PATCH RERESEND 11/11] splice: splice_to_socket: always request MSG_DONTWAIT Ahelenia Ziemiańska
2023-12-14 18:45   ` Ahelenia Ziemiańska
2023-12-14 19:06 ` [PATCH RERESEND 00/11] splice(file<>pipe) I/O on file as-if O_NONBLOCK Jens Axboe
2023-12-14 20:14   ` Ahelenia Ziemiańska

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=107ff087-92de-4be5-a205-610376d41d72@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nabijaczleweli@nabijaczleweli.xyz \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.