Skip to content

Commit 1fa4ffd

Browse files
author
Al Viro
committed
close_files(): don't bother with xchg()
At that point nobody else has references to the victim files_struct; as the matter of fact, the caller will free it immediately after close_files() returns, with no RCU delays or anything of that sort. That's why we are not protecting against fdtable reallocation on expansion, not cleaning the bitmaps, etc. There's no point zeroing the pointers in ->fd[] either, let alone make that an atomic operation. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent be5498c commit 1fa4ffd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ static struct fdtable *close_files(struct files_struct * files)
413413
set = fdt->open_fds[j++];
414414
while (set) {
415415
if (set & 1) {
416-
struct file * file = xchg(&fdt->fd[i], NULL);
416+
struct file *file = fdt->fd[i];
417417
if (file) {
418418
filp_close(file, files);
419419
cond_resched();

0 commit comments

Comments
 (0)