fix: file: Rename fcheck lookup_fd_rcu (v5.11)
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 7 Jan 2021 17:10:23 +0000 (12:10 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 19 Jan 2021 14:28:29 +0000 (09:28 -0500)
See upstream commit:

  commit 460b4f812a9d473d4b39d87d37844f9fc30a9eb3
  Author: Eric W. Biederman <ebiederm@xmission.com>
  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 <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I33d2c912ebfdf82a68e506c9b6be17c51d2f254e

include/wrapper/fdtable.h
src/probes/lttng-uprobes.c

index 996199a7b00093a4615362fc17f0fb1ea7241b70..559a1dcea073a034ee277e170db62a259c8b94d0 100644 (file)
 #include <linux/version.h>
 #include <linux/fdtable.h>
 
+#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,
index b9007146d39fbb3504f287f845890de38f867834..031bfa7cd3affafed75130840405d9c08ad17438 100644 (file)
@@ -9,7 +9,7 @@
  *
  */
 
-#include <linux/fdtable.h>
+#include <wrapper/fdtable.h>
 #include <linux/list.h>
 #include <linux/module.h>
 #include <linux/namei.h>
@@ -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;
This page took 0.02566 seconds and 5 git commands to generate.