linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: linux-fsdevel@vger.kernel.org
Cc: Christian Brauner <christian@brauner.io>
Subject: [PATCH 4/6] kernel_file_open(): get rid of inode argument
Date: Sat, 6 Apr 2024 06:01:13 +0100	[thread overview]
Message-ID: <20240406050113.GD1632446@ZenIV> (raw)
In-Reply-To: <20240406045622.GY538574@ZenIV>

always equal to ->dentry->d_inode of the path argument these
days.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/cachefiles/namei.c | 3 +--
 fs/open.c             | 5 ++---
 fs/overlayfs/util.c   | 2 +-
 include/linux/fs.h    | 2 +-
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c
index 7ade836beb58..f53977169db4 100644
--- a/fs/cachefiles/namei.c
+++ b/fs/cachefiles/namei.c
@@ -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),
diff --git a/fs/open.c b/fs/open.c
index ee8460c83c77..ec287ac67e7f 100644
--- 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);
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index d285d1d7baad..edc9216f6e27 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -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);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 00fc429b0af0..143e967a3af2 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -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 *),
-- 
2.39.2


  parent reply	other threads:[~2024-04-06  5:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-06  4:56 [PATCHES] misc stuff that should've been pushed in the last window Al Viro
2024-04-06  4:57 ` [PATCH 1/6] close_on_exec(): pass files_struct instead of fdtable Al Viro
2024-04-09  9:21   ` Christian Brauner
2024-04-06  4:57 ` [PATCH 2/6] fd_is_open(): move to fs/file.c Al Viro
2024-04-09  9:21   ` Christian Brauner
2024-04-06  5:00 ` [PATCH 3/6] get_file_rcu(): no need to check for NULL separately Al Viro
2024-04-09  9:23   ` Christian Brauner
2024-04-06  5:01 ` Al Viro [this message]
2024-04-09  9:24   ` [PATCH 4/6] kernel_file_open(): get rid of inode argument Christian Brauner
2024-04-06  5:01 ` [PATCH 5/6] do_dentry_open(): kill " Al Viro
2024-04-09  9:25   ` Christian Brauner
2024-04-06  5:02 ` [PATCH 6/6] remove call_{read,write}_iter() functions Al Viro
2024-04-09  9:26   ` Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240406050113.GD1632446@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=christian@brauner.io \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).