Commit acfa4380efe77e290d3a96b11cd4c9f24f4fbb18
1 parent
9742df331d
Exists in
master
and in
20 other branches
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>
Showing 10 changed files with 28 additions and 35 deletions Side-by-side Diff
fs/cifs/inode.c
fs/ecryptfs/inode.c
... | ... | @@ -612,8 +612,7 @@ |
612 | 612 | struct ecryptfs_crypt_stat *crypt_stat; |
613 | 613 | |
614 | 614 | lower_dentry = ecryptfs_dentry_to_lower(dentry); |
615 | - if (!lower_dentry->d_inode->i_op || | |
616 | - !lower_dentry->d_inode->i_op->readlink) { | |
615 | + if (!lower_dentry->d_inode->i_op->readlink) { | |
617 | 616 | rc = -EINVAL; |
618 | 617 | goto out; |
619 | 618 | } |
fs/namei.c
... | ... | @@ -257,7 +257,7 @@ |
257 | 257 | return -EACCES; |
258 | 258 | } |
259 | 259 | |
260 | - if (inode->i_op && inode->i_op->permission) | |
260 | + if (inode->i_op->permission) | |
261 | 261 | retval = inode->i_op->permission(inode, mask); |
262 | 262 | else |
263 | 263 | retval = generic_permission(inode, mask, NULL); |
... | ... | @@ -432,7 +432,7 @@ |
432 | 432 | { |
433 | 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 | 436 | return -EAGAIN; |
437 | 437 | |
438 | 438 | if (current_fsuid() == inode->i_uid) |
... | ... | @@ -908,9 +908,6 @@ |
908 | 908 | inode = next.dentry->d_inode; |
909 | 909 | if (!inode) |
910 | 910 | goto out_dput; |
911 | - err = -ENOTDIR; | |
912 | - if (!inode->i_op) | |
913 | - goto out_dput; | |
914 | 911 | |
915 | 912 | if (inode->i_op->follow_link) { |
916 | 913 | err = do_follow_link(&next, nd); |
... | ... | @@ -920,9 +917,6 @@ |
920 | 917 | inode = nd->path.dentry->d_inode; |
921 | 918 | if (!inode) |
922 | 919 | break; |
923 | - err = -ENOTDIR; | |
924 | - if (!inode->i_op) | |
925 | - break; | |
926 | 920 | } else |
927 | 921 | path_to_nameidata(&next, nd); |
928 | 922 | err = -ENOTDIR; |
... | ... | @@ -961,7 +955,7 @@ |
961 | 955 | break; |
962 | 956 | inode = next.dentry->d_inode; |
963 | 957 | if ((lookup_flags & LOOKUP_FOLLOW) |
964 | - && inode && inode->i_op && inode->i_op->follow_link) { | |
958 | + && inode && inode->i_op->follow_link) { | |
965 | 959 | err = do_follow_link(&next, nd); |
966 | 960 | if (err) |
967 | 961 | goto return_err; |
... | ... | @@ -973,7 +967,7 @@ |
973 | 967 | break; |
974 | 968 | if (lookup_flags & LOOKUP_DIRECTORY) { |
975 | 969 | err = -ENOTDIR; |
976 | - if (!inode->i_op || !inode->i_op->lookup) | |
970 | + if (!inode->i_op->lookup) | |
977 | 971 | break; |
978 | 972 | } |
979 | 973 | goto return_base; |
... | ... | @@ -1469,7 +1463,7 @@ |
1469 | 1463 | if (error) |
1470 | 1464 | return error; |
1471 | 1465 | |
1472 | - if (!dir->i_op || !dir->i_op->create) | |
1466 | + if (!dir->i_op->create) | |
1473 | 1467 | return -EACCES; /* shouldn't it be ENOSYS? */ |
1474 | 1468 | mode &= S_IALLUGO; |
1475 | 1469 | mode |= S_IFREG; |
... | ... | @@ -1752,7 +1746,7 @@ |
1752 | 1746 | error = -ENOENT; |
1753 | 1747 | if (!path.dentry->d_inode) |
1754 | 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 | 1750 | goto do_link; |
1757 | 1751 | |
1758 | 1752 | path_to_nameidata(&path, &nd); |
... | ... | @@ -1933,7 +1927,7 @@ |
1933 | 1927 | if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD)) |
1934 | 1928 | return -EPERM; |
1935 | 1929 | |
1936 | - if (!dir->i_op || !dir->i_op->mknod) | |
1930 | + if (!dir->i_op->mknod) | |
1937 | 1931 | return -EPERM; |
1938 | 1932 | |
1939 | 1933 | error = devcgroup_inode_mknod(mode, dev); |
... | ... | @@ -2035,7 +2029,7 @@ |
2035 | 2029 | if (error) |
2036 | 2030 | return error; |
2037 | 2031 | |
2038 | - if (!dir->i_op || !dir->i_op->mkdir) | |
2032 | + if (!dir->i_op->mkdir) | |
2039 | 2033 | return -EPERM; |
2040 | 2034 | |
2041 | 2035 | mode &= (S_IRWXUGO|S_ISVTX); |
... | ... | @@ -2126,7 +2120,7 @@ |
2126 | 2120 | if (error) |
2127 | 2121 | return error; |
2128 | 2122 | |
2129 | - if (!dir->i_op || !dir->i_op->rmdir) | |
2123 | + if (!dir->i_op->rmdir) | |
2130 | 2124 | return -EPERM; |
2131 | 2125 | |
2132 | 2126 | DQUOT_INIT(dir); |
... | ... | @@ -2213,7 +2207,7 @@ |
2213 | 2207 | if (error) |
2214 | 2208 | return error; |
2215 | 2209 | |
2216 | - if (!dir->i_op || !dir->i_op->unlink) | |
2210 | + if (!dir->i_op->unlink) | |
2217 | 2211 | return -EPERM; |
2218 | 2212 | |
2219 | 2213 | DQUOT_INIT(dir); |
... | ... | @@ -2320,7 +2314,7 @@ |
2320 | 2314 | if (error) |
2321 | 2315 | return error; |
2322 | 2316 | |
2323 | - if (!dir->i_op || !dir->i_op->symlink) | |
2317 | + if (!dir->i_op->symlink) | |
2324 | 2318 | return -EPERM; |
2325 | 2319 | |
2326 | 2320 | error = security_inode_symlink(dir, dentry, oldname); |
... | ... | @@ -2401,7 +2395,7 @@ |
2401 | 2395 | */ |
2402 | 2396 | if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) |
2403 | 2397 | return -EPERM; |
2404 | - if (!dir->i_op || !dir->i_op->link) | |
2398 | + if (!dir->i_op->link) | |
2405 | 2399 | return -EPERM; |
2406 | 2400 | if (S_ISDIR(inode->i_mode)) |
2407 | 2401 | return -EPERM; |
... | ... | @@ -2608,7 +2602,7 @@ |
2608 | 2602 | if (error) |
2609 | 2603 | return error; |
2610 | 2604 | |
2611 | - if (!old_dir->i_op || !old_dir->i_op->rename) | |
2605 | + if (!old_dir->i_op->rename) | |
2612 | 2606 | return -EPERM; |
2613 | 2607 | |
2614 | 2608 | DQUOT_INIT(old_dir); |
fs/nfsd/vfs.c
... | ... | @@ -1211,7 +1211,7 @@ |
1211 | 1211 | dirp = dentry->d_inode; |
1212 | 1212 | |
1213 | 1213 | err = nfserr_notdir; |
1214 | - if(!dirp->i_op || !dirp->i_op->lookup) | |
1214 | + if (!dirp->i_op->lookup) | |
1215 | 1215 | goto out; |
1216 | 1216 | /* |
1217 | 1217 | * Check whether the response file handle has been verified yet. |
... | ... | @@ -1347,7 +1347,7 @@ |
1347 | 1347 | /* Get all the sanity checks out of the way before |
1348 | 1348 | * we lock the parent. */ |
1349 | 1349 | err = nfserr_notdir; |
1350 | - if(!dirp->i_op || !dirp->i_op->lookup) | |
1350 | + if (!dirp->i_op->lookup) | |
1351 | 1351 | goto out; |
1352 | 1352 | fh_lock_nested(fhp, I_MUTEX_PARENT); |
1353 | 1353 | |
... | ... | @@ -1482,7 +1482,7 @@ |
1482 | 1482 | inode = dentry->d_inode; |
1483 | 1483 | |
1484 | 1484 | err = nfserr_inval; |
1485 | - if (!inode->i_op || !inode->i_op->readlink) | |
1485 | + if (!inode->i_op->readlink) | |
1486 | 1486 | goto out; |
1487 | 1487 | |
1488 | 1488 | touch_atime(fhp->fh_export->ex_path.mnt, dentry); |
... | ... | @@ -2162,7 +2162,7 @@ |
2162 | 2162 | size_t size; |
2163 | 2163 | int error; |
2164 | 2164 | |
2165 | - if (!IS_POSIXACL(inode) || !inode->i_op || | |
2165 | + if (!IS_POSIXACL(inode) || | |
2166 | 2166 | !inode->i_op->setxattr || !inode->i_op->removexattr) |
2167 | 2167 | return -EOPNOTSUPP; |
2168 | 2168 | switch(type) { |
fs/open.c
... | ... | @@ -412,7 +412,7 @@ |
412 | 412 | if (((offset + len) > inode->i_sb->s_maxbytes) || ((offset + len) < 0)) |
413 | 413 | goto out_fput; |
414 | 414 | |
415 | - if (inode->i_op && inode->i_op->fallocate) | |
415 | + if (inode->i_op->fallocate) | |
416 | 416 | ret = inode->i_op->fallocate(inode, mode, offset, len); |
417 | 417 | else |
418 | 418 | ret = -EOPNOTSUPP; |
fs/stat.c
... | ... | @@ -305,7 +305,7 @@ |
305 | 305 | struct inode *inode = path.dentry->d_inode; |
306 | 306 | |
307 | 307 | error = -EINVAL; |
308 | - if (inode->i_op && inode->i_op->readlink) { | |
308 | + if (inode->i_op->readlink) { | |
309 | 309 | error = security_inode_readlink(path.dentry); |
310 | 310 | if (!error) { |
311 | 311 | touch_atime(path.mnt, path.dentry); |
fs/xattr.c
... | ... | @@ -175,7 +175,7 @@ |
175 | 175 | if (error) |
176 | 176 | return error; |
177 | 177 | error = -EOPNOTSUPP; |
178 | - if (d->d_inode->i_op && d->d_inode->i_op->listxattr) { | |
178 | + if (d->d_inode->i_op->listxattr) { | |
179 | 179 | error = d->d_inode->i_op->listxattr(d, list, size); |
180 | 180 | } else { |
181 | 181 | error = security_inode_listsecurity(d->d_inode, list, size); |
mm/memory.c
... | ... | @@ -2266,7 +2266,7 @@ |
2266 | 2266 | unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1); |
2267 | 2267 | } |
2268 | 2268 | |
2269 | - if (inode->i_op && inode->i_op->truncate) | |
2269 | + if (inode->i_op->truncate) | |
2270 | 2270 | inode->i_op->truncate(inode); |
2271 | 2271 | return 0; |
2272 | 2272 | |
... | ... | @@ -2286,7 +2286,7 @@ |
2286 | 2286 | * a way to truncate a range of blocks (punch a hole) - |
2287 | 2287 | * we should return failure right now. |
2288 | 2288 | */ |
2289 | - if (!inode->i_op || !inode->i_op->truncate_range) | |
2289 | + if (!inode->i_op->truncate_range) | |
2290 | 2290 | return -ENOSYS; |
2291 | 2291 | |
2292 | 2292 | mutex_lock(&inode->i_mutex); |
mm/nommu.c
security/commoncap.c
... | ... | @@ -238,7 +238,7 @@ |
238 | 238 | struct inode *inode = dentry->d_inode; |
239 | 239 | int error; |
240 | 240 | |
241 | - if (!inode->i_op || !inode->i_op->getxattr) | |
241 | + if (!inode->i_op->getxattr) | |
242 | 242 | return 0; |
243 | 243 | |
244 | 244 | error = inode->i_op->getxattr(dentry, XATTR_NAME_CAPS, NULL, 0); |
... | ... | @@ -259,7 +259,7 @@ |
259 | 259 | { |
260 | 260 | struct inode *inode = dentry->d_inode; |
261 | 261 | |
262 | - if (!inode->i_op || !inode->i_op->removexattr) | |
262 | + if (!inode->i_op->removexattr) | |
263 | 263 | return 0; |
264 | 264 | |
265 | 265 | return inode->i_op->removexattr(dentry, XATTR_NAME_CAPS); |
... | ... | @@ -317,7 +317,7 @@ |
317 | 317 | |
318 | 318 | memset(cpu_caps, 0, sizeof(struct cpu_vfs_cap_data)); |
319 | 319 | |
320 | - if (!inode || !inode->i_op || !inode->i_op->getxattr) | |
320 | + if (!inode || !inode->i_op->getxattr) | |
321 | 321 | return -ENODATA; |
322 | 322 | |
323 | 323 | size = inode->i_op->getxattr((struct dentry *)dentry, XATTR_NAME_CAPS, &caps, |