fs/pipe: set FMODE_NOWAIT in create_pipe_files()
Jens Axboe
maintainerPATCH 1/1 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.
---
fs/pipe.c +5 -3
@@ -964,6 +964,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.
@@ -998,9 +1003,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:
io_uring/openclose.c +0 -2
@@ -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);
Signature · 1 line
Jens Axboe
Quoted 8 lines · Jens Axboe
Rather than have the caller set the
FMODE_NOWAITflags for both output files, move it tocreate_pipe_files()where otherf_modeflags are set anyway withstream_open(). With that, both__do_pipe_flags()andio_pipe()can remove the manual setting of the NOWAIT flags.No intended functional changes, just a code cleanup.
[...]
Applied to the vfs-6.17.misc branch of the vfs/vfs.git tree. Patches in the vfs-6.17.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs-6.17.misc
[1/1] fs/pipe: set FMODE_NOWAIT in create_pipe_files()
https://git.kernel.org/vfs/vfs/c/80c17f7374cf