]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
file: Rename fcheck lookup_fd_rcu
authorEric W. Biederman <ebiederm@xmission.com>
Fri, 20 Nov 2020 23:14:27 +0000 (17:14 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Jun 2024 12:52:48 +0000 (14:52 +0200)
[ Upstream commit 460b4f812a9d473d4b39d87d37844f9fc30a9eb3 ]

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
Link: https://lkml.kernel.org/r/20201120231441.29911-10-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>
Documentation/filesystems/files.rst
arch/powerpc/platforms/cell/spufs/coredump.c
fs/notify/dnotify/dnotify.c
include/linux/fdtable.h

index ea75acdb632c045fc6d9012e2264a699fed9e7f2..bcf84459917f50ab693aa2eeec9f070d22ee49a0 100644 (file)
@@ -62,7 +62,7 @@ the fdtable structure -
    be held.
 
 4. To look up the file structure given an fd, a reader
-   must use either fcheck() or files_lookup_fd_rcu() APIs. These
+   must use either lookup_fd_rcu() or files_lookup_fd_rcu() APIs. These
    take care of barrier requirements due to lock-free lookup.
 
    An example::
@@ -70,7 +70,7 @@ the fdtable structure -
        struct file *file;
 
        rcu_read_lock();
-       file = fcheck(fd);
+       file = lookup_fd_rcu(fd);
        if (file) {
                ...
        }
@@ -104,7 +104,7 @@ the fdtable structure -
    lock-free, they must be installed using rcu_assign_pointer()
    API. If they are looked up lock-free, rcu_dereference()
    must be used. However it is advisable to use files_fdtable()
-   and fcheck()/files_lookup_fd_rcu() which take care of these issues.
+   and lookup_fd_rcu()/files_lookup_fd_rcu() which take care of these issues.
 
 7. While updating, the fdtable pointer must be looked up while
    holding files->file_lock. If ->file_lock is dropped, then
index 026c181a98c5d310158ceba5a94cbfe8a5a1cf00..60b5583e9eafccba2788c477652985397935bdb9 100644 (file)
@@ -74,7 +74,7 @@ static struct spu_context *coredump_next_context(int *fd)
        *fd = n - 1;
 
        rcu_read_lock();
-       file = fcheck(*fd);
+       file = lookup_fd_rcu(*fd);
        ctx = SPUFS_I(file_inode(file))->i_ctx;
        get_spu_context(ctx);
        rcu_read_unlock();
index e45ca6ecba959163b8b4b7b32787c5b1e61e701c..e85e13c50d6d48289bb07a38507fcdc0ec703cdb 100644 (file)
@@ -327,7 +327,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
        }
 
        rcu_read_lock();
-       f = fcheck(fd);
+       f = lookup_fd_rcu(fd);
        rcu_read_unlock();
 
        /* if (f != filp) means that we lost a race and another task/thread
index a45fa2ef723f510a6456ce59b5b572c4efb815f4..695306cc5337a85bd973aeb77ca458dfa9565d22 100644 (file)
@@ -105,10 +105,10 @@ static inline struct file *files_lookup_fd_rcu(struct files_struct *files, unsig
        return files_lookup_fd_raw(files, fd);
 }
 
-/*
- * Check whether the specified fd has an open file.
- */
-#define fcheck(fd)     files_lookup_fd_rcu(current->files, fd)
+static inline struct file *lookup_fd_rcu(unsigned int fd)
+{
+       return files_lookup_fd_rcu(current->files, fd);
+}
 
 struct task_struct;