aboutsummaryrefslogtreecommitdiff
path: root/kernel/exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 83beb1e93b1..6d2089a1bce 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -411,15 +411,16 @@ void fastcall put_files_struct(struct files_struct *files)
close_files(files);
/*
* Free the fd and fdset arrays if we expanded them.
+ * If the fdtable was embedded, pass files for freeing
+ * at the end of the RCU grace period. Otherwise,
+ * you can free files immediately.
*/
fdt = files_fdtable(files);
- if (fdt->fd != &files->fd_array[0])
- free_fd_array(fdt->fd, fdt->max_fds);
- if (fdt->max_fdset > __FD_SETSIZE) {
- free_fdset(fdt->open_fds, fdt->max_fdset);
- free_fdset(fdt->close_on_exec, fdt->max_fdset);
- }
- kmem_cache_free(files_cachep, files);
+ if (fdt == &files->fdtab)
+ fdt->free_files = files;
+ else
+ kmem_cache_free(files_cachep, files);
+ free_fdtable(fdt);
}
}