pipe: set FMODE_NOWAIT on pipes pipe-nonblock
authorJens Axboe <axboe@kernel.dk>
Wed, 8 Mar 2023 00:56:28 +0000 (17:56 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 15 Mar 2023 17:37:29 +0000 (11:37 -0600)
The read/write path is now prepared to deal with IOCB_NOWAIT, hence
enable support for that via setting FMODE_NOWAIT on new pipes.

Acked-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/pipe.c

index dc00b20e56c8800c5748da4b819f13583f9c4ac5..b7e380952fca7f394a994c8e23d4d1d45fb6a148 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -999,6 +999,9 @@ static int __do_pipe_flags(int *fd, struct file **files, int flags)
        audit_fd_pair(fdr, fdw);
        fd[0] = fdr;
        fd[1] = fdw;
+       /* pipe groks IOCB_NOWAIT */
+       files[0]->f_mode |= FMODE_NOWAIT;
+       files[1]->f_mode |= FMODE_NOWAIT;
        return 0;
 
  err_fdr: