summaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfsproc.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2021-03-01 20:37:10 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2021-03-08 10:19:35 -0500
commit6e3e2c4362e41a2f18e3f7a5ad81bd2f49a47b85 (patch)
treeef51a46d8ebbfa4300e6fa4f1c20b171b351bf13 /fs/nfsd/nfsproc.c
parenta38fd8748464831584a19438cbb3082b5a2dab15 (diff)
downloadlinux-stable-6e3e2c4362e41a2f18e3f7a5ad81bd2f49a47b85.tar.gz
linux-stable-6e3e2c4362e41a2f18e3f7a5ad81bd2f49a47b85.tar.bz2
linux-stable-6e3e2c4362e41a2f18e3f7a5ad81bd2f49a47b85.zip
new helper: inode_wrong_type()
inode_wrong_type(inode, mode) returns true if setting inode->i_mode to given value would've changed the inode type. We have enough of those checks open-coded to make a helper worthwhile. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nfsd/nfsproc.c')
-rw-r--r--fs/nfsd/nfsproc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index a8d5449dd0e9..6d51687a0585 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -381,7 +381,7 @@ nfsd_proc_create(struct svc_rqst *rqstp)
/* Make sure the type and device matches */
resp->status = nfserr_exist;
- if (inode && type != (inode->i_mode & S_IFMT))
+ if (inode && inode_wrong_type(inode, type))
goto out_unlock;
}