summaryrefslogtreecommitdiffstats
path: root/fs/proc/fd.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2020-11-21 00:14:26 +0100
committerEric W. Biederman <ebiederm@xmission.com>2020-12-10 19:40:03 +0100
commitf36c2943274199cb8aef32ac96531ffb7c4b43d0 (patch)
tree45e9f9d75456064982722d09d85c023e2708db6b /fs/proc/fd.c
parentfile: Factor files_lookup_fd_locked out of fcheck_files (diff)
downloadlinux-f36c2943274199cb8aef32ac96531ffb7c4b43d0.tar.xz
linux-f36c2943274199cb8aef32ac96531ffb7c4b43d0.zip
file: Replace fcheck_files with files_lookup_fd_rcu
This change renames fcheck_files to files_lookup_fd_rcu. All of the remaining callers take the rcu_read_lock before calling this function so the _rcu suffix is appropriate. This change also tightens up the debug check to verify that all callers hold the rcu_read_lock. All callers that used to call files_check with the files->file_lock held have now been changed to call files_lookup_fd_locked. This change of name has helped remind me of which locks and which guarantees are in place helping me to catch bugs later in the patchset. The need for better names became apparent in the last round of discussion of this set of changes[1]. [1] https://lkml.kernel.org/r/CAHk-=wj8BQbgJFLa+J0e=iT-1qpmCRTbPAJ8gd6MJQ=kbRPqyQ@mail.gmail.com Link: https://lkml.kernel.org/r/20201120231441.29911-9-ebiederm@xmission.com Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'fs/proc/fd.c')
-rw-r--r--fs/proc/fd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index 2cca9bca3b3a..3dec44d7c5c5 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -90,7 +90,7 @@ static bool tid_fd_mode(struct task_struct *task, unsigned fd, fmode_t *mode)
return false;
rcu_read_lock();
- file = fcheck_files(files, fd);
+ file = files_lookup_fd_rcu(files, fd);
if (file)
*mode = file->f_mode;
rcu_read_unlock();
@@ -243,7 +243,7 @@ static int proc_readfd_common(struct file *file, struct dir_context *ctx,
char name[10 + 1];
unsigned int len;
- f = fcheck_files(files, fd);
+ f = files_lookup_fd_rcu(files, fd);
if (!f)
continue;
data.mode = f->f_mode;