summaryrefslogtreecommitdiff
path: root/fs/file.c
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2023-11-30 13:49:07 +0100
committerChristian Brauner <brauner@kernel.org>2023-12-12 14:24:13 +0100
commita88c955fcfb49727d0ed86b47410f6555a8e69e4 (patch)
treeb04466bef8909dde0b11b95ffcfb9975c9f8e55e /fs/file.c
parent253ca8678d30bcf94410b54476fc1e0f1627a137 (diff)
downloadlwn-a88c955fcfb49727d0ed86b47410f6555a8e69e4.tar.gz
lwn-a88c955fcfb49727d0ed86b47410f6555a8e69e4.zip
file: s/close_fd_get_file()/file_close_fd()/g
That really shouldn't have "get" in there as that implies we're bumping the reference count which we don't do at all. We used to but not anmore. Now we're just closing the fd and pick that file from the fdtable without bumping the reference count. Update the wrong documentation while at it. Link: https://lore.kernel.org/r/20231130-vfs-files-fixes-v1-1-e73ca6f4ea83@kernel.org Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/file.c')
-rw-r--r--fs/file.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/file.c b/fs/file.c
index 50df31e104a5..66f04442a384 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -796,7 +796,7 @@ int __close_range(unsigned fd, unsigned max_fd, unsigned int flags)
}
/*
- * See close_fd_get_file() below, this variant assumes current->files->file_lock
+ * See file_close_fd() below, this variant assumes current->files->file_lock
* is held.
*/
struct file *__close_fd_get_file(unsigned int fd)
@@ -804,11 +804,15 @@ struct file *__close_fd_get_file(unsigned int fd)
return pick_file(current->files, fd);
}
-/*
- * variant of close_fd that gets a ref on the file for later fput.
- * The caller must ensure that filp_close() called on the file.
+/**
+ * file_close_fd - return file associated with fd
+ * @fd: file descriptor to retrieve file for
+ *
+ * Doesn't take a separate reference count.
+ *
+ * Returns: The file associated with @fd (NULL if @fd is not open)
*/
-struct file *close_fd_get_file(unsigned int fd)
+struct file *file_close_fd(unsigned int fd)
{
struct files_struct *files = current->files;
struct file *file;