]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fs/pipe: set FMODE_NOWAIT in create_pipe_files()
authorJens Axboe <axboe@kernel.dk>
Fri, 30 May 2025 11:25:35 +0000 (05:25 -0600)
committerChristian Brauner <brauner@kernel.org>
Tue, 10 Jun 2025 11:16:19 +0000 (13:16 +0200)
Rather than have the caller set the FMODE_NOWAIT flags for both output
files, move it to create_pipe_files() where other f_mode flags are set
anyway with stream_open(). With that, both __do_pipe_flags() and
io_pipe() can remove the manual setting of the NOWAIT flags.

No intended functional changes, just a code cleanup.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/1f0473f8-69f3-4eb1-aa77-3334c6a71d24@kernel.dk
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/pipe.c
io_uring/openclose.c

index 45077c37bad154ef146b047834d35d489fcc4d8d..731622d0738d41a9d918dc5048e95e38b3b0e049 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -963,6 +963,11 @@ int create_pipe_files(struct file **res, int flags)
        res[1] = f;
        stream_open(inode, res[0]);
        stream_open(inode, res[1]);
+
+       /* pipe groks IOCB_NOWAIT */
+       res[0]->f_mode |= FMODE_NOWAIT;
+       res[1]->f_mode |= FMODE_NOWAIT;
+
        /*
         * Disable permission and pre-content events, but enable legacy
         * inotify events for legacy users.
@@ -997,9 +1002,6 @@ 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:
index 83e36ad4e31be9cc32f32f7e128a62e84fa8080a..d70700e5cef88d57322e5a3f5f5c0d9f955f75bb 100644 (file)
@@ -416,8 +416,6 @@ int io_pipe(struct io_kiocb *req, unsigned int issue_flags)
        ret = create_pipe_files(files, p->flags);
        if (ret)
                return ret;
-       files[0]->f_mode |= FMODE_NOWAIT;
-       files[1]->f_mode |= FMODE_NOWAIT;
 
        if (!!p->file_slot)
                ret = io_pipe_fixed(req, files, issue_flags);