From 703e3e9a9cb1221e59a088745482c02f863d7999 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 3 Aug 2022 21:27:11 -0400 Subject: exfat_iterate(): don't open-code file_inode(file) and it's file, not filp... Reviewed-by: Christian Brauner (Microsoft) Signed-off-by: Al Viro --- fs/exfat/dir.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fs') diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index a27b55ec060a..0fc08fdcba73 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -212,9 +212,9 @@ static void exfat_free_namebuf(struct exfat_dentry_namebuf *nb) /* skip iterating emit_dots when dir is empty */ #define ITER_POS_FILLED_DOTS (2) -static int exfat_iterate(struct file *filp, struct dir_context *ctx) +static int exfat_iterate(struct file *file, struct dir_context *ctx) { - struct inode *inode = filp->f_path.dentry->d_inode; + struct inode *inode = file_inode(file); struct super_block *sb = inode->i_sb; struct inode *tmp; struct exfat_dir_entry de; @@ -228,7 +228,7 @@ static int exfat_iterate(struct file *filp, struct dir_context *ctx) mutex_lock(&EXFAT_SB(sb)->s_lock); cpos = ctx->pos; - if (!dir_emit_dots(filp, ctx)) + if (!dir_emit_dots(file, ctx)) goto unlock; if (ctx->pos == ITER_POS_FILLED_DOTS) { -- cgit v1.2.3-70-g09d2 From e6ae43812460450bdb42f14c5813ac42d6bc9067 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 20 Aug 2022 11:46:10 -0400 Subject: bprm_fill_uid(): don't open-code file_inode() Reviewed-by: Christian Brauner (Microsoft) Signed-off-by: Al Viro --- fs/exec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'fs') diff --git a/fs/exec.c b/fs/exec.c index f793221f4eb6..c1867122204a 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1595,7 +1595,7 @@ static void bprm_fill_uid(struct linux_binprm *bprm, struct file *file) { /* Handle suid and sgid on files */ struct user_namespace *mnt_userns; - struct inode *inode; + struct inode *inode = file_inode(file); unsigned int mode; kuid_t uid; kgid_t gid; @@ -1606,7 +1606,6 @@ static void bprm_fill_uid(struct linux_binprm *bprm, struct file *file) if (task_no_new_privs(current)) return; - inode = file->f_path.dentry->d_inode; mode = READ_ONCE(inode->i_mode); if (!(mode & (S_ISUID|S_ISGID))) return; -- cgit v1.2.3-70-g09d2 From 1f24cd31c28178415158366b676c2e18be812940 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 20 Aug 2022 11:47:03 -0400 Subject: nfs_finish_open(): don't open-code file_inode() Reviewed-by: Christian Brauner (Microsoft) Signed-off-by: Al Viro --- fs/nfs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index dbab3caa15ed..bcb2500c49b8 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -2022,7 +2022,7 @@ static int nfs_finish_open(struct nfs_open_context *ctx, err = finish_open(file, dentry, do_open); if (err) goto out; - if (S_ISREG(file->f_path.dentry->d_inode->i_mode)) + if (S_ISREG(file_inode(file)->i_mode)) nfs_file_set_open_context(file, ctx); else err = -EOPENSTALE; -- cgit v1.2.3-70-g09d2 From 265a04b076077b3f5a169231e290ad106d3aa2ca Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 20 Aug 2022 13:12:02 -0400 Subject: _nfs42_proc_copy(): use ->f_mapping instead of file_inode()->i_mapping Reviewed-by: Christian Brauner (Microsoft) Signed-off-by: Al Viro --- fs/nfs/nfs42proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c index 068c45b3bc1a..542502199005 100644 --- a/fs/nfs/nfs42proc.c +++ b/fs/nfs/nfs42proc.c @@ -336,7 +336,7 @@ static ssize_t _nfs42_proc_copy(struct file *src, return status; } } - status = nfs_filemap_write_and_wait_range(file_inode(src)->i_mapping, + status = nfs_filemap_write_and_wait_range(src->f_mapping, pos_src, pos_src + (loff_t)count - 1); if (status) return status; -- cgit v1.2.3-70-g09d2 From 4094d98e3375833737b467998219338ffd46a68b Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 20 Aug 2022 13:14:38 -0400 Subject: orangefs: use ->f_mapping ... and don't check for impossible conditions - file_inode() is never NULL in anything seen by ->release() and neither is its ->i_mapping. Reviewed-by: Christian Brauner (Microsoft) Signed-off-by: Al Viro --- fs/orangefs/file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'fs') diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c index 86810e5d7914..732661aa2680 100644 --- a/fs/orangefs/file.c +++ b/fs/orangefs/file.c @@ -417,9 +417,7 @@ static int orangefs_file_release(struct inode *inode, struct file *file) * readahead cache (if any); this forces an expensive refresh of * data for the next caller of mmap (or 'get_block' accesses) */ - if (file_inode(file) && - file_inode(file)->i_mapping && - mapping_nrpages(&file_inode(file)->i_data)) { + if (mapping_nrpages(file->f_mapping)) { if (orangefs_features & ORANGEFS_FEATURE_READAHEAD) { gossip_debug(GOSSIP_INODE_DEBUG, "calling flush_racache on %pU\n", -- cgit v1.2.3-70-g09d2