kernel_samsung_a53x/fs/proc
Eric W. Biederman 111c37fdf7 proc/fd: In fdinfo seq_show don't use get_files_struct
[ Upstream commit 775e0656b27210ae668e33af00bece858f44576f ]

When discussing[1] exec and posix file locks it was realized that none
of the callers of get_files_struct fundamentally needed to call
get_files_struct, and that by switching them to helper functions
instead it will both simplify their code and remove unnecessary
increments of files_struct.count.  Those unnecessary increments can
result in exec unnecessarily unsharing files_struct which breaking
posix locks, and it can result in fget_light having to fallback to
fget reducing system performance.

Instead hold task_lock for the duration that task->files needs to be
stable in seq_show.  The task_lock was already taken in
get_files_struct, and so skipping get_files_struct performs less work
overall, and avoids the problems with the files_struct reference
count.

[1] https://lkml.kernel.org/r/20180915160423.GA31461@redhat.com
Suggested-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
v1: https://lkml.kernel.org/r/20200817220425.9389-12-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/20201120231441.29911-17-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:28 +01:00
..
array.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
base.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bootconfig.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cmdline.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
consoles.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cpuinfo.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
devices.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fd.c proc/fd: In fdinfo seq_show don't use get_files_struct 2024-11-19 12:27:28 +01:00
fd.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fslog.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
generic.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inode.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
internal.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
interrupts.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kcore.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kmsg.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
loadavg.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
meminfo.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
namespaces.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nommu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
page.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
proc_net.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
proc_sysctl.c watchdog: move softlockup_panic back to early_param 2024-11-18 11:43:21 +01:00
proc_tty.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
root.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
self.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
softirqs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stat.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
task_mmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
task_nommu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
thread_self.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uptime.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
util.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
version.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vmcore.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00