From: Michael Jeanson Date: Thu, 7 Jan 2021 17:10:23 +0000 (-0500) Subject: fix: file: Rename fcheck lookup_fd_rcu (v5.11) X-Git-Tag: v2.13.0-rc1~60 X-Git-Url: http://git.lttng.org/?p=lttng-modules.git;a=commitdiff_plain;h=0aebcd682f2b7dc028e635297c504b39439551da fix: file: Rename fcheck lookup_fd_rcu (v5.11) See upstream commit: commit 460b4f812a9d473d4b39d87d37844f9fc30a9eb3 Author: Eric W. Biederman Date: Fri Nov 20 17:14:27 2020 -0600 file: Rename fcheck lookup_fd_rcu Also remove the confusing comment about checking if a fd exists. I could not find one instance in the entire kernel that still matches the description or the reason for the name fcheck. 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 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers Change-Id: I33d2c912ebfdf82a68e506c9b6be17c51d2f254e --- diff --git a/include/wrapper/fdtable.h b/include/wrapper/fdtable.h index 996199a7..559a1dce 100644 --- a/include/wrapper/fdtable.h +++ b/include/wrapper/fdtable.h @@ -11,6 +11,20 @@ #include #include +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0)) +static inline +struct file *lttng_lookup_fd_rcu(unsigned int fd) +{ + return lookup_fd_rcu(fd); +} +#else +static inline +struct file *lttng_lookup_fd_rcu(unsigned int fd) +{ + return fcheck(fd); +} +#endif + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) int lttng_iterate_fd(struct files_struct *files, diff --git a/src/probes/lttng-uprobes.c b/src/probes/lttng-uprobes.c index b9007146..031bfa7c 100644 --- a/src/probes/lttng-uprobes.c +++ b/src/probes/lttng-uprobes.c @@ -9,7 +9,7 @@ * */ -#include +#include #include #include #include @@ -170,7 +170,7 @@ static struct inode *get_inode_from_fd(int fd) * Returns the file backing the given fd. Needs to be done inside an RCU * critical section. */ - file = fcheck(fd); + file = lttng_lookup_fd_rcu(fd); if (file == NULL) { printk(KERN_WARNING "LTTng: Cannot access file backing the fd(%d)\n", fd); inode = NULL;