kernel_file_open(): get rid of inode argument
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 20 Jan 2024 11:24:55 +0000 (06:24 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 15 Apr 2024 20:03:24 +0000 (16:03 -0400)
always equal to ->dentry->d_inode of the path argument these
days.

Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/cachefiles/namei.c
fs/open.c
fs/overlayfs/util.c
include/linux/fs.h

index 7ade836beb58450f8a5eb389fac1df0f722ac8ed..f53977169db48c873cf97758644128228cc230ad 100644 (file)
@@ -563,8 +563,7 @@ static bool cachefiles_open_file(struct cachefiles_object *object,
         */
        path.mnt = cache->mnt;
        path.dentry = dentry;
-       file = kernel_file_open(&path, O_RDWR | O_LARGEFILE | O_DIRECT,
-                               d_backing_inode(dentry), cache->cache_cred);
+       file = kernel_file_open(&path, O_RDWR | O_LARGEFILE | O_DIRECT, cache->cache_cred);
        if (IS_ERR(file)) {
                trace_cachefiles_vfs_error(object, d_backing_inode(dentry),
                                           PTR_ERR(file),
index ee8460c83c779d86a6ed478bcabda88d19b6e977..ec287ac67e7ff36028539a2f79bee4e482a32afb 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -1155,7 +1155,6 @@ EXPORT_SYMBOL(dentry_create);
  * kernel_file_open - open a file for kernel internal use
  * @path:      path of the file to open
  * @flags:     open flags
- * @inode:     the inode
  * @cred:      credentials for open
  *
  * Open a file for use by in-kernel consumers. The file is not accounted
@@ -1165,7 +1164,7 @@ EXPORT_SYMBOL(dentry_create);
  * Return: Opened file on success, an error pointer on failure.
  */
 struct file *kernel_file_open(const struct path *path, int flags,
-                               struct inode *inode, const struct cred *cred)
+                               const struct cred *cred)
 {
        struct file *f;
        int error;
@@ -1175,7 +1174,7 @@ struct file *kernel_file_open(const struct path *path, int flags,
                return f;
 
        f->f_path = *path;
-       error = do_dentry_open(f, inode, NULL);
+       error = do_dentry_open(f, d_inode(path->dentry), NULL);
        if (error) {
                fput(f);
                f = ERR_PTR(error);
index d285d1d7baaddedf6fc938ac8aaf8dc35e74d7d7..edc9216f6e27ad2aad3b83e73ca6e7e6f6df9c0c 100644 (file)
@@ -1376,7 +1376,7 @@ int ovl_ensure_verity_loaded(struct path *datapath)
                 * If this inode was not yet opened, the verity info hasn't been
                 * loaded yet, so we need to do that here to force it into memory.
                 */
-               filp = kernel_file_open(datapath, O_RDONLY, inode, current_cred());
+               filp = kernel_file_open(datapath, O_RDONLY, current_cred());
                if (IS_ERR(filp))
                        return PTR_ERR(filp);
                fput(filp);
index 00fc429b0af0fb9bbab2382a9e347fdbac383981..143e967a3af26d23d787169e76f59d1521f7c22b 100644 (file)
@@ -1906,7 +1906,7 @@ struct file *kernel_tmpfile_open(struct mnt_idmap *idmap,
                                 umode_t mode, int open_flag,
                                 const struct cred *cred);
 struct file *kernel_file_open(const struct path *path, int flags,
-                             struct inode *inode, const struct cred *cred);
+                             const struct cred *cred);
 
 int vfs_mkobj(struct dentry *, umode_t,
                int (*f)(struct dentry *, umode_t, void *),