aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-12-04 10:06:33 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2009-01-05 11:54:28 -0500
commitacfa4380efe77e290d3a96b11cd4c9f24f4fbb18 (patch)
treed656232c7ef39c83681c2de4c8e28ba439242f66 /fs/namei.c
parent9742df331deb3fce95b321f38d4ea0c4e75edb63 (diff)
inode->i_op is never NULL
We used to have rather schizophrenic set of checks for NULL ->i_op even though it had been eliminated years ago. You'd need to go out of your way to set it to NULL explicitly _and_ a bunch of code would die on such inodes anyway. After killing two remaining places that still did that bogosity, all that crap can go away. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/fs/namei.c b/fs/namei.c
index dd5c9f0bf829..1f6656c3d1b9 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -257,7 +257,7 @@ int inode_permission(struct inode *inode, int mask)
257 return -EACCES; 257 return -EACCES;
258 } 258 }
259 259
260 if (inode->i_op && inode->i_op->permission) 260 if (inode->i_op->permission)
261 retval = inode->i_op->permission(inode, mask); 261 retval = inode->i_op->permission(inode, mask);
262 else 262 else
263 retval = generic_permission(inode, mask, NULL); 263 retval = generic_permission(inode, mask, NULL);
@@ -432,7 +432,7 @@ static int exec_permission_lite(struct inode *inode)
432{ 432{
433 umode_t mode = inode->i_mode; 433 umode_t mode = inode->i_mode;
434 434
435 if (inode->i_op && inode->i_op->permission) 435 if (inode->i_op->permission)
436 return -EAGAIN; 436 return -EAGAIN;
437 437
438 if (current_fsuid() == inode->i_uid) 438 if (current_fsuid() == inode->i_uid)
@@ -908,9 +908,6 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
908 inode = next.dentry->d_inode; 908 inode = next.dentry->d_inode;
909 if (!inode) 909 if (!inode)
910 goto out_dput; 910 goto out_dput;
911 err = -ENOTDIR;
912 if (!inode->i_op)
913 goto out_dput;
914 911
915 if (inode->i_op->follow_link) { 912 if (inode->i_op->follow_link) {
916 err = do_follow_link(&next, nd); 913 err = do_follow_link(&next, nd);
@@ -920,9 +917,6 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
920 inode = nd->path.dentry->d_inode; 917 inode = nd->path.dentry->d_inode;
921 if (!inode) 918 if (!inode)
922 break; 919 break;
923 err = -ENOTDIR;
924 if (!inode->i_op)
925 break;
926 } else 920 } else
927 path_to_nameidata(&next, nd); 921 path_to_nameidata(&next, nd);
928 err = -ENOTDIR; 922 err = -ENOTDIR;
@@ -961,7 +955,7 @@ last_component:
961 break; 955 break;
962 inode = next.dentry->d_inode; 956 inode = next.dentry->d_inode;
963 if ((lookup_flags & LOOKUP_FOLLOW) 957 if ((lookup_flags & LOOKUP_FOLLOW)
964 && inode && inode->i_op && inode->i_op->follow_link) { 958 && inode && inode->i_op->follow_link) {
965 err = do_follow_link(&next, nd); 959 err = do_follow_link(&next, nd);
966 if (err) 960 if (err)
967 goto return_err; 961 goto return_err;
@@ -973,7 +967,7 @@ last_component:
973 break; 967 break;
974 if (lookup_flags & LOOKUP_DIRECTORY) { 968 if (lookup_flags & LOOKUP_DIRECTORY) {
975 err = -ENOTDIR; 969 err = -ENOTDIR;
976 if (!inode->i_op || !inode->i_op->lookup) 970 if (!inode->i_op->lookup)
977 break; 971 break;
978 } 972 }
979 goto return_base; 973 goto return_base;
@@ -1469,7 +1463,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode,
1469 if (error) 1463 if (error)
1470 return error; 1464 return error;
1471 1465
1472 if (!dir->i_op || !dir->i_op->create) 1466 if (!dir->i_op->create)
1473 return -EACCES; /* shouldn't it be ENOSYS? */ 1467 return -EACCES; /* shouldn't it be ENOSYS? */
1474 mode &= S_IALLUGO; 1468 mode &= S_IALLUGO;
1475 mode |= S_IFREG; 1469 mode |= S_IFREG;
@@ -1752,7 +1746,7 @@ do_last:
1752 error = -ENOENT; 1746 error = -ENOENT;
1753 if (!path.dentry->d_inode) 1747 if (!path.dentry->d_inode)
1754 goto exit_dput; 1748 goto exit_dput;
1755 if (path.dentry->d_inode->i_op && path.dentry->d_inode->i_op->follow_link) 1749 if (path.dentry->d_inode->i_op->follow_link)
1756 goto do_link; 1750 goto do_link;
1757 1751
1758 path_to_nameidata(&path, &nd); 1752 path_to_nameidata(&path, &nd);
@@ -1933,7 +1927,7 @@ int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
1933 if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD)) 1927 if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD))
1934 return -EPERM; 1928 return -EPERM;
1935 1929
1936 if (!dir->i_op || !dir->i_op->mknod) 1930 if (!dir->i_op->mknod)
1937 return -EPERM; 1931 return -EPERM;
1938 1932
1939 error = devcgroup_inode_mknod(mode, dev); 1933 error = devcgroup_inode_mknod(mode, dev);
@@ -2035,7 +2029,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
2035 if (error) 2029 if (error)
2036 return error; 2030 return error;
2037 2031
2038 if (!dir->i_op || !dir->i_op->mkdir) 2032 if (!dir->i_op->mkdir)
2039 return -EPERM; 2033 return -EPERM;
2040 2034
2041 mode &= (S_IRWXUGO|S_ISVTX); 2035 mode &= (S_IRWXUGO|S_ISVTX);
@@ -2126,7 +2120,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
2126 if (error) 2120 if (error)
2127 return error; 2121 return error;
2128 2122
2129 if (!dir->i_op || !dir->i_op->rmdir) 2123 if (!dir->i_op->rmdir)
2130 return -EPERM; 2124 return -EPERM;
2131 2125
2132 DQUOT_INIT(dir); 2126 DQUOT_INIT(dir);
@@ -2213,7 +2207,7 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
2213 if (error) 2207 if (error)
2214 return error; 2208 return error;
2215 2209
2216 if (!dir->i_op || !dir->i_op->unlink) 2210 if (!dir->i_op->unlink)
2217 return -EPERM; 2211 return -EPERM;
2218 2212
2219 DQUOT_INIT(dir); 2213 DQUOT_INIT(dir);
@@ -2320,7 +2314,7 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
2320 if (error) 2314 if (error)
2321 return error; 2315 return error;
2322 2316
2323 if (!dir->i_op || !dir->i_op->symlink) 2317 if (!dir->i_op->symlink)
2324 return -EPERM; 2318 return -EPERM;
2325 2319
2326 error = security_inode_symlink(dir, dentry, oldname); 2320 error = security_inode_symlink(dir, dentry, oldname);
@@ -2401,7 +2395,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
2401 */ 2395 */
2402 if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) 2396 if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
2403 return -EPERM; 2397 return -EPERM;
2404 if (!dir->i_op || !dir->i_op->link) 2398 if (!dir->i_op->link)
2405 return -EPERM; 2399 return -EPERM;
2406 if (S_ISDIR(inode->i_mode)) 2400 if (S_ISDIR(inode->i_mode))
2407 return -EPERM; 2401 return -EPERM;
@@ -2608,7 +2602,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
2608 if (error) 2602 if (error)
2609 return error; 2603 return error;
2610 2604
2611 if (!old_dir->i_op || !old_dir->i_op->rename) 2605 if (!old_dir->i_op->rename)
2612 return -EPERM; 2606 return -EPERM;
2613 2607
2614 DQUOT_INIT(old_dir); 2608 DQUOT_INIT(old_dir);