mbox series

[PATCHSET,for-next,0/2] Make pipe honor IOCB_NOWAIT

Message ID 20230307154533.11164-1-axboe@kernel.dk (mailing list archive)
Headers show
Series Make pipe honor IOCB_NOWAIT | expand

Message

Jens Axboe March 7, 2023, 3:45 p.m. UTC
Hi,

File types that implement read_iter/write_iter should check for
IOCB_NOWAIT in conjunction with O_NONBLOCK, so it can correctly bail
with -EAGAIN if we need to block for space/data. pipe doesn't currently
do that, and that's the primary reason for why io_uring needs to use
a slower path for it.

Add the appropriate check, and expand the io_uring "understands nonblock"
check so that we catch it.

Comments

Dave Chinner March 8, 2023, 12:19 a.m. UTC | #1
On Tue, Mar 07, 2023 at 08:45:31AM -0700, Jens Axboe wrote:
> Hi,
> 
> File types that implement read_iter/write_iter should check for
> IOCB_NOWAIT

Since when? If so, what's the point of setting FMODE_NOWAIT when the
struct file is opened to indicate the file has comprehensive
IOCB_NOWAIT support in the underlying IO path?

Cheers,

Dave.
Jens Axboe March 8, 2023, 12:31 a.m. UTC | #2
On 3/7/23 5:19 PM, Dave Chinner wrote:
> On Tue, Mar 07, 2023 at 08:45:31AM -0700, Jens Axboe wrote:
>> Hi,
>>
>> File types that implement read_iter/write_iter should check for
>> IOCB_NOWAIT
> 
> Since when? If so, what's the point of setting FMODE_NOWAIT when the
> struct file is opened to indicate the file has comprehensive
> IOCB_NOWAIT support in the underlying IO path?

Guess I missed that FMODE_NOWAIT is supposed to be added for that,
my naive assumption was that the iter based one should check. Which
is a bad sad, but at least there's a flag for it.

But the good news is that I can drop the io_uring patch, just need
to revise the pipe patch. I'll send a v2.