diff options
author | Mateusz Guzik <mguzik@redhat.com> | 2016-08-23 16:20:38 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-24 10:07:36 +0200 |
commit | f750847daa22bee9cbb3309f11e8c2eef7bbe5c6 (patch) | |
tree | fc879850b2ea213f1b642738245df5b5e50e4360 /fs | |
parent | 0d57cbc66b9018f548f6f0dd3b1aff8bf1a214d2 (diff) |
mm: introduce get_task_exe_file
commit cd81a9170e69e018bbaba547c1fd85a585f5697a upstream.
For more convenient access if one has a pointer to the task.
As a minor nit take advantage of the fact that only task lock + rcu are
needed to safely grab ->exe_file. This saves mm refcount dance.
Use the helper in proc_exe_link.
Signed-off-by: Mateusz Guzik <mguzik@redhat.com>
Acked-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Acked-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/base.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index e8bbf6cdb437..d2b8c754f627 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -1545,18 +1545,13 @@ static const struct file_operations proc_pid_set_comm_operations = { static int proc_exe_link(struct dentry *dentry, struct path *exe_path) { struct task_struct *task; - struct mm_struct *mm; struct file *exe_file; task = get_proc_task(d_inode(dentry)); if (!task) return -ENOENT; - mm = get_task_mm(task); + exe_file = get_task_exe_file(task); put_task_struct(task); - if (!mm) - return -ENOENT; - exe_file = get_mm_exe_file(mm); - mmput(mm); if (exe_file) { *exe_path = exe_file->f_path; path_get(&exe_file->f_path); |