Skip to content

Commit dd765ba

Browse files
axboebrauner
authored andcommitted
fs/pipe: set FMODE_NOWAIT in create_pipe_files()
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>
1 parent cd95e36 commit dd765ba

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

fs/pipe.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,11 @@ int create_pipe_files(struct file **res, int flags)
963963
res[1] = f;
964964
stream_open(inode, res[0]);
965965
stream_open(inode, res[1]);
966+
967+
/* pipe groks IOCB_NOWAIT */
968+
res[0]->f_mode |= FMODE_NOWAIT;
969+
res[1]->f_mode |= FMODE_NOWAIT;
970+
966971
/*
967972
* Disable permission and pre-content events, but enable legacy
968973
* inotify events for legacy users.
@@ -997,9 +1002,6 @@ static int __do_pipe_flags(int *fd, struct file **files, int flags)
9971002
audit_fd_pair(fdr, fdw);
9981003
fd[0] = fdr;
9991004
fd[1] = fdw;
1000-
/* pipe groks IOCB_NOWAIT */
1001-
files[0]->f_mode |= FMODE_NOWAIT;
1002-
files[1]->f_mode |= FMODE_NOWAIT;
10031005
return 0;
10041006

10051007
err_fdr:

io_uring/openclose.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,6 @@ int io_pipe(struct io_kiocb *req, unsigned int issue_flags)
416416
ret = create_pipe_files(files, p->flags);
417417
if (ret)
418418
return ret;
419-
files[0]->f_mode |= FMODE_NOWAIT;
420-
files[1]->f_mode |= FMODE_NOWAIT;
421419

422420
if (!!p->file_slot)
423421
ret = io_pipe_fixed(req, files, issue_flags);

0 commit comments

Comments
 (0)