diff options
| author | Christian Brauner <brauner@kernel.org> | 2026-09-10 17:48:05 +0200 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-09-14 15:58:07 +0200 |
| commit | 6ee9e7d4fbc83cec6d9914967a09c8d977822126 (patch) | |
| tree | ffe7c597003f6aafe509147c4cbec272605e7025 | |
| parent | d99d38540bf0084df2ac30dc72a2d14eaa4d2db2 (diff) | |
| download | linux-next-6ee9e7d4fbc83cec6d9914967a09c8d977822126.tar.gz linux-next-6ee9e7d4fbc83cec6d9914967a09c8d977822126.zip | |
fs: make close_range() synchronous
__range_close() closes through filp_close() so every file the caller
held the last reference to is punted to task work. That costs one
cmpxchg per file plus a list entry for any later task_work_cancel() to
search under ->pi_lock. close_range(2) exists to close many descriptors
in one go fast. So convert it to the same synchronous treatment as
close(2) and close_files().
Flush and put each file inline while ->file_lock is dropped.
close_range(2) now behaves like close(2).
Link: https://patch.msgid.link/20260910-work-coredump-unlock-self-v4-7-a5c1800dc930@kernel.org
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
| -rw-r--r-- | fs/file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/file.c b/fs/file.c index b2b466dce7fb..178c8cb9da09 100644 --- a/fs/file.c +++ b/fs/file.c @@ -807,7 +807,7 @@ static inline void __range_close(struct files_struct *files, unsigned int fd, file = file_close_fd_locked(files, fd); if (file) { spin_unlock(&files->file_lock); - filp_close(file, files); + filp_close_sync(file, files); cond_resched(); spin_lock(&files->file_lock); fdt = files_fdtable(files); |
