Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6:
merge fchmod() and fchmodat() guts, kill ancient broken kludge
xfs: fix misspelled S_IS...()
xfs: get rid of open-coded S_ISREG(), etc.
vfs: document locking requirements for d_move, __d_move and d_materialise_unique
omfs: fix (mode & S_IFDIR) abuse
btrfs: S_ISREG(mode) is not mode & S_IFREG...
ima: fmode_t misspelled as mode_t...
pci-label.c: size_t misspelled as mode_t
jffs2: S_ISLNK(mode & S_IFMT) is pointless
snd_msnd ->mode is fmode_t, not mode_t
v9fs_iop_get_acl: get rid of unused variable
vfs: dont chain pipe/anon/socket on superblock s_inodes list
Documentation: Exporting: update description of d_splice_alias
fs: add missing unlock in default_llseek()

+133 -120
+8 -1
Documentation/filesystems/nfs/Exporting
··· 92 92 1/ provide the filehandle fragment routines described below. 93 93 2/ make sure that d_splice_alias is used rather than d_add 94 94 when ->lookup finds an inode for a given parent and name. 95 - Typically the ->lookup routine will end with a: 95 + 96 + If inode is NULL, d_splice_alias(inode, dentry) is eqivalent to 97 + 98 + d_add(dentry, inode), NULL 99 + 100 + Similarly, d_splice_alias(ERR_PTR(err), dentry) = ERR_PTR(err) 101 + 102 + Typically the ->lookup routine will simply end with a: 96 103 97 104 return d_splice_alias(inode, dentry); 98 105 }
+1 -1
drivers/pci/pci-label.c
··· 55 55 SMBIOS_ATTR_INSTANCE_SHOW, 56 56 }; 57 57 58 - static mode_t 58 + static size_t 59 59 find_smbios_instance_string(struct pci_dev *pdev, char *buf, 60 60 enum smbios_attr_enum attribute) 61 61 {
+1 -1
fs/anon_inodes.c
··· 187 187 */ 188 188 static struct inode *anon_inode_mkinode(void) 189 189 { 190 - struct inode *inode = new_inode(anon_inode_mnt->mnt_sb); 190 + struct inode *inode = new_inode_pseudo(anon_inode_mnt->mnt_sb); 191 191 192 192 if (!inode) 193 193 return ERR_PTR(-ENOMEM);
+2 -2
fs/btrfs/inode.c
··· 4467 4467 inode->i_generation = BTRFS_I(inode)->generation; 4468 4468 btrfs_set_inode_space_info(root, inode); 4469 4469 4470 - if (mode & S_IFDIR) 4470 + if (S_ISDIR(mode)) 4471 4471 owner = 0; 4472 4472 else 4473 4473 owner = 1; ··· 4512 4512 4513 4513 btrfs_inherit_iflags(inode, dir); 4514 4514 4515 - if ((mode & S_IFREG)) { 4515 + if (S_ISREG(mode)) { 4516 4516 if (btrfs_test_opt(root, NODATASUM)) 4517 4517 BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM; 4518 4518 if (btrfs_test_opt(root, NODATACOW) ||
+7 -4
fs/dcache.c
··· 2138 2138 * @target: new dentry 2139 2139 * 2140 2140 * Update the dcache to reflect the move of a file name. Negative 2141 - * dcache entries should not be moved in this way. Caller hold 2142 - * rename_lock. 2141 + * dcache entries should not be moved in this way. Caller must hold 2142 + * rename_lock, the i_mutex of the source and target directories, 2143 + * and the sb->s_vfs_rename_mutex if they differ. See lock_rename(). 2143 2144 */ 2144 2145 static void __d_move(struct dentry * dentry, struct dentry * target) 2145 2146 { ··· 2203 2202 * @target: new dentry 2204 2203 * 2205 2204 * Update the dcache to reflect the move of a file name. Negative 2206 - * dcache entries should not be moved in this way. 2205 + * dcache entries should not be moved in this way. See the locking 2206 + * requirements for __d_move. 2207 2207 */ 2208 2208 void d_move(struct dentry *dentry, struct dentry *target) 2209 2209 { ··· 2322 2320 * @inode: inode to bind to the dentry, to which aliases may be attached 2323 2321 * 2324 2322 * Introduces an dentry into the tree, substituting an extant disconnected 2325 - * root directory alias in its place if there is one 2323 + * root directory alias in its place if there is one. Caller must hold the 2324 + * i_mutex of the parent directory. 2326 2325 */ 2327 2326 struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) 2328 2327 {
+30 -9
fs/inode.c
··· 361 361 362 362 static inline void inode_sb_list_del(struct inode *inode) 363 363 { 364 - spin_lock(&inode_sb_list_lock); 365 - list_del_init(&inode->i_sb_list); 366 - spin_unlock(&inode_sb_list_lock); 364 + if (!list_empty(&inode->i_sb_list)) { 365 + spin_lock(&inode_sb_list_lock); 366 + list_del_init(&inode->i_sb_list); 367 + spin_unlock(&inode_sb_list_lock); 368 + } 367 369 } 368 370 369 371 static unsigned long hash(struct super_block *sb, unsigned long hashval) ··· 798 796 EXPORT_SYMBOL(get_next_ino); 799 797 800 798 /** 799 + * new_inode_pseudo - obtain an inode 800 + * @sb: superblock 801 + * 802 + * Allocates a new inode for given superblock. 803 + * Inode wont be chained in superblock s_inodes list 804 + * This means : 805 + * - fs can't be unmount 806 + * - quotas, fsnotify, writeback can't work 807 + */ 808 + struct inode *new_inode_pseudo(struct super_block *sb) 809 + { 810 + struct inode *inode = alloc_inode(sb); 811 + 812 + if (inode) { 813 + spin_lock(&inode->i_lock); 814 + inode->i_state = 0; 815 + spin_unlock(&inode->i_lock); 816 + INIT_LIST_HEAD(&inode->i_sb_list); 817 + } 818 + return inode; 819 + } 820 + 821 + /** 801 822 * new_inode - obtain an inode 802 823 * @sb: superblock 803 824 * ··· 838 813 839 814 spin_lock_prefetch(&inode_sb_list_lock); 840 815 841 - inode = alloc_inode(sb); 842 - if (inode) { 843 - spin_lock(&inode->i_lock); 844 - inode->i_state = 0; 845 - spin_unlock(&inode->i_lock); 816 + inode = new_inode_pseudo(sb); 817 + if (inode) 846 818 inode_sb_list_add(inode); 847 - } 848 819 return inode; 849 820 } 850 821 EXPORT_SYMBOL(new_inode);
+1 -1
fs/jffs2/fs.c
··· 80 80 ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); 81 81 if (ret) { 82 82 jffs2_free_raw_inode(ri); 83 - if (S_ISLNK(inode->i_mode & S_IFMT)) 83 + if (S_ISLNK(inode->i_mode)) 84 84 kfree(mdata); 85 85 return ret; 86 86 }
+1 -1
fs/omfs/dir.c
··· 93 93 94 94 memset(bh->b_data, 0, sizeof(struct omfs_inode)); 95 95 96 - if (inode->i_mode & S_IFDIR) { 96 + if (S_ISDIR(inode->i_mode)) { 97 97 memset(&bh->b_data[OMFS_DIR_START], 0xff, 98 98 sbi->s_sys_blocksize - OMFS_DIR_START); 99 99 } else
+28 -50
fs/open.c
··· 446 446 return error; 447 447 } 448 448 449 - SYSCALL_DEFINE2(fchmod, unsigned int, fd, mode_t, mode) 449 + static int chmod_common(struct path *path, umode_t mode) 450 450 { 451 - struct inode * inode; 452 - struct dentry * dentry; 453 - struct file * file; 454 - int err = -EBADF; 451 + struct inode *inode = path->dentry->d_inode; 455 452 struct iattr newattrs; 453 + int error; 456 454 457 - file = fget(fd); 458 - if (!file) 459 - goto out; 460 - 461 - dentry = file->f_path.dentry; 462 - inode = dentry->d_inode; 463 - 464 - audit_inode(NULL, dentry); 465 - 466 - err = mnt_want_write_file(file); 467 - if (err) 468 - goto out_putf; 455 + error = mnt_want_write(path->mnt); 456 + if (error) 457 + return error; 469 458 mutex_lock(&inode->i_mutex); 470 - err = security_path_chmod(dentry, file->f_vfsmnt, mode); 471 - if (err) 459 + error = security_path_chmod(path->dentry, path->mnt, mode); 460 + if (error) 472 461 goto out_unlock; 473 - if (mode == (mode_t) -1) 474 - mode = inode->i_mode; 475 462 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); 476 463 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; 477 - err = notify_change(dentry, &newattrs); 464 + error = notify_change(path->dentry, &newattrs); 478 465 out_unlock: 479 466 mutex_unlock(&inode->i_mutex); 480 - mnt_drop_write(file->f_path.mnt); 481 - out_putf: 482 - fput(file); 483 - out: 467 + mnt_drop_write(path->mnt); 468 + return error; 469 + } 470 + 471 + SYSCALL_DEFINE2(fchmod, unsigned int, fd, mode_t, mode) 472 + { 473 + struct file * file; 474 + int err = -EBADF; 475 + 476 + file = fget(fd); 477 + if (file) { 478 + audit_inode(NULL, file->f_path.dentry); 479 + err = chmod_common(&file->f_path, mode); 480 + fput(file); 481 + } 484 482 return err; 485 483 } 486 484 487 485 SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, mode_t, mode) 488 486 { 489 487 struct path path; 490 - struct inode *inode; 491 488 int error; 492 - struct iattr newattrs; 493 489 494 490 error = user_path_at(dfd, filename, LOOKUP_FOLLOW, &path); 495 - if (error) 496 - goto out; 497 - inode = path.dentry->d_inode; 498 - 499 - error = mnt_want_write(path.mnt); 500 - if (error) 501 - goto dput_and_out; 502 - mutex_lock(&inode->i_mutex); 503 - error = security_path_chmod(path.dentry, path.mnt, mode); 504 - if (error) 505 - goto out_unlock; 506 - if (mode == (mode_t) -1) 507 - mode = inode->i_mode; 508 - newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); 509 - newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; 510 - error = notify_change(path.dentry, &newattrs); 511 - out_unlock: 512 - mutex_unlock(&inode->i_mutex); 513 - mnt_drop_write(path.mnt); 514 - dput_and_out: 515 - path_put(&path); 516 - out: 491 + if (!error) { 492 + error = chmod_common(&path, mode); 493 + path_put(&path); 494 + } 517 495 return error; 518 496 } 519 497
+1 -1
fs/pipe.c
··· 948 948 949 949 static struct inode * get_pipe_inode(void) 950 950 { 951 - struct inode *inode = new_inode(pipe_mnt->mnt_sb); 951 + struct inode *inode = new_inode_pseudo(pipe_mnt->mnt_sb); 952 952 struct pipe_inode_info *pipe; 953 953 954 954 if (!inode)
+8 -4
fs/read_write.c
··· 166 166 * long as offset isn't at the end of the file then the 167 167 * offset is data. 168 168 */ 169 - if (offset >= inode->i_size) 170 - return -ENXIO; 169 + if (offset >= inode->i_size) { 170 + retval = -ENXIO; 171 + goto out; 172 + } 171 173 break; 172 174 case SEEK_HOLE: 173 175 /* ··· 177 175 * as long as offset isn't i_size or larger, return 178 176 * i_size. 179 177 */ 180 - if (offset >= inode->i_size) 181 - return -ENXIO; 178 + if (offset >= inode->i_size) { 179 + retval = -ENXIO; 180 + goto out; 181 + } 182 182 offset = inode->i_size; 183 183 break; 184 184 }
+3 -3
fs/xfs/linux-2.6/xfs_ioctl.c
··· 265 265 return PTR_ERR(filp); 266 266 } 267 267 268 - if (inode->i_mode & S_IFREG) { 268 + if (S_ISREG(inode->i_mode)) { 269 269 filp->f_flags |= O_NOATIME; 270 270 filp->f_mode |= FMODE_NOCMTIME; 271 271 } ··· 850 850 di_flags |= XFS_DIFLAG_NODEFRAG; 851 851 if (xflags & XFS_XFLAG_FILESTREAM) 852 852 di_flags |= XFS_DIFLAG_FILESTREAM; 853 - if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) { 853 + if (S_ISDIR(ip->i_d.di_mode)) { 854 854 if (xflags & XFS_XFLAG_RTINHERIT) 855 855 di_flags |= XFS_DIFLAG_RTINHERIT; 856 856 if (xflags & XFS_XFLAG_NOSYMLINKS) 857 857 di_flags |= XFS_DIFLAG_NOSYMLINKS; 858 858 if (xflags & XFS_XFLAG_EXTSZINHERIT) 859 859 di_flags |= XFS_DIFLAG_EXTSZINHERIT; 860 - } else if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) { 860 + } else if (S_ISREG(ip->i_d.di_mode)) { 861 861 if (xflags & XFS_XFLAG_REALTIME) 862 862 di_flags |= XFS_DIFLAG_REALTIME; 863 863 if (xflags & XFS_XFLAG_EXTSIZE)
+3 -4
fs/xfs/xfs_bmap.c
··· 414 414 415 415 if (ip->i_df.if_bytes <= XFS_IFORK_DSIZE(ip)) 416 416 return 0; 417 - if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) { 417 + if (S_ISDIR(ip->i_d.di_mode)) { 418 418 mp = ip->i_mount; 419 419 memset(&dargs, 0, sizeof(dargs)); 420 420 dargs.dp = ip; ··· 3344 3344 * We don't want to deal with the case of keeping inode data inline yet. 3345 3345 * So sending the data fork of a regular inode is invalid. 3346 3346 */ 3347 - ASSERT(!((ip->i_d.di_mode & S_IFMT) == S_IFREG && 3348 - whichfork == XFS_DATA_FORK)); 3347 + ASSERT(!(S_ISREG(ip->i_d.di_mode) && whichfork == XFS_DATA_FORK)); 3349 3348 ifp = XFS_IFORK_PTR(ip, whichfork); 3350 3349 ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL); 3351 3350 flags = 0; ··· 4051 4052 4052 4053 #ifndef DEBUG 4053 4054 if (whichfork == XFS_DATA_FORK) { 4054 - return ((ip->i_d.di_mode & S_IFMT) == S_IFREG) ? 4055 + return S_ISREG(ip->i_d.di_mode) ? 4055 4056 (ip->i_size == ip->i_mount->m_sb.sb_blocksize) : 4056 4057 (ip->i_d.di_size == ip->i_mount->m_sb.sb_blocksize); 4057 4058 }
+8 -8
fs/xfs/xfs_dir2.c
··· 121 121 { 122 122 xfs_dir2_sf_hdr_t *sfp; 123 123 124 - ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 124 + ASSERT(S_ISDIR(dp->i_d.di_mode)); 125 125 if (dp->i_d.di_size == 0) /* might happen during shutdown. */ 126 126 return 1; 127 127 if (dp->i_d.di_size > XFS_IFORK_DSIZE(dp)) ··· 179 179 memset((char *)&args, 0, sizeof(args)); 180 180 args.dp = dp; 181 181 args.trans = tp; 182 - ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 182 + ASSERT(S_ISDIR(dp->i_d.di_mode)); 183 183 if ((error = xfs_dir_ino_validate(tp->t_mountp, pdp->i_ino))) 184 184 return error; 185 185 return xfs_dir2_sf_create(&args, pdp->i_ino); ··· 202 202 int rval; 203 203 int v; /* type-checking value */ 204 204 205 - ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 205 + ASSERT(S_ISDIR(dp->i_d.di_mode)); 206 206 if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) 207 207 return rval; 208 208 XFS_STATS_INC(xs_dir_create); ··· 278 278 int rval; 279 279 int v; /* type-checking value */ 280 280 281 - ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 281 + ASSERT(S_ISDIR(dp->i_d.di_mode)); 282 282 XFS_STATS_INC(xs_dir_lookup); 283 283 284 284 memset(&args, 0, sizeof(xfs_da_args_t)); ··· 333 333 int rval; 334 334 int v; /* type-checking value */ 335 335 336 - ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 336 + ASSERT(S_ISDIR(dp->i_d.di_mode)); 337 337 XFS_STATS_INC(xs_dir_remove); 338 338 339 339 memset(&args, 0, sizeof(xfs_da_args_t)); ··· 382 382 if (XFS_FORCED_SHUTDOWN(dp->i_mount)) 383 383 return XFS_ERROR(EIO); 384 384 385 - ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 385 + ASSERT(S_ISDIR(dp->i_d.di_mode)); 386 386 XFS_STATS_INC(xs_dir_getdents); 387 387 388 388 if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) ··· 414 414 int rval; 415 415 int v; /* type-checking value */ 416 416 417 - ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 417 + ASSERT(S_ISDIR(dp->i_d.di_mode)); 418 418 419 419 if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) 420 420 return rval; ··· 464 464 if (resblks) 465 465 return 0; 466 466 467 - ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 467 + ASSERT(S_ISDIR(dp->i_d.di_mode)); 468 468 469 469 memset(&args, 0, sizeof(xfs_da_args_t)); 470 470 args.name = name->name;
+7 -7
fs/xfs/xfs_filestream.c
··· 344 344 * Either ip is a regular file and pip is a directory, or ip is a 345 345 * directory and pip is NULL. 346 346 */ 347 - ASSERT(ip && (((ip->i_d.di_mode & S_IFREG) && pip && 348 - (pip->i_d.di_mode & S_IFDIR)) || 349 - ((ip->i_d.di_mode & S_IFDIR) && !pip))); 347 + ASSERT(ip && ((S_ISREG(ip->i_d.di_mode) && pip && 348 + S_ISDIR(pip->i_d.di_mode)) || 349 + (S_ISDIR(ip->i_d.di_mode) && !pip))); 350 350 351 351 mp = ip->i_mount; 352 352 cache = mp->m_filestream; ··· 537 537 xfs_agnumber_t ag; 538 538 int ref; 539 539 540 - if (!(ip->i_d.di_mode & (S_IFREG | S_IFDIR))) { 540 + if (!S_ISREG(ip->i_d.di_mode) && !S_ISDIR(ip->i_d.di_mode)) { 541 541 ASSERT(0); 542 542 return NULLAGNUMBER; 543 543 } ··· 579 579 xfs_agnumber_t ag, rotorstep, startag; 580 580 int err = 0; 581 581 582 - ASSERT(pip->i_d.di_mode & S_IFDIR); 583 - ASSERT(ip->i_d.di_mode & S_IFREG); 584 - if (!(pip->i_d.di_mode & S_IFDIR) || !(ip->i_d.di_mode & S_IFREG)) 582 + ASSERT(S_ISDIR(pip->i_d.di_mode)); 583 + ASSERT(S_ISREG(ip->i_d.di_mode)); 584 + if (!S_ISDIR(pip->i_d.di_mode) || !S_ISREG(ip->i_d.di_mode)) 585 585 return -EINVAL; 586 586 587 587 mp = pip->i_mount;
+8 -8
fs/xfs/xfs_inode.c
··· 368 368 /* 369 369 * no local regular files yet 370 370 */ 371 - if (unlikely((be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFREG)) { 371 + if (unlikely(S_ISREG(be16_to_cpu(dip->di_mode)))) { 372 372 xfs_warn(ip->i_mount, 373 373 "corrupt inode %Lu (local format for regular file).", 374 374 (unsigned long long) ip->i_ino); ··· 1040 1040 1041 1041 if (pip && XFS_INHERIT_GID(pip)) { 1042 1042 ip->i_d.di_gid = pip->i_d.di_gid; 1043 - if ((pip->i_d.di_mode & S_ISGID) && (mode & S_IFMT) == S_IFDIR) { 1043 + if ((pip->i_d.di_mode & S_ISGID) && S_ISDIR(mode)) { 1044 1044 ip->i_d.di_mode |= S_ISGID; 1045 1045 } 1046 1046 } ··· 1097 1097 if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) { 1098 1098 uint di_flags = 0; 1099 1099 1100 - if ((mode & S_IFMT) == S_IFDIR) { 1100 + if (S_ISDIR(mode)) { 1101 1101 if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) 1102 1102 di_flags |= XFS_DIFLAG_RTINHERIT; 1103 1103 if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) { 1104 1104 di_flags |= XFS_DIFLAG_EXTSZINHERIT; 1105 1105 ip->i_d.di_extsize = pip->i_d.di_extsize; 1106 1106 } 1107 - } else if ((mode & S_IFMT) == S_IFREG) { 1107 + } else if (S_ISREG(mode)) { 1108 1108 if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) 1109 1109 di_flags |= XFS_DIFLAG_REALTIME; 1110 1110 if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) { ··· 1188 1188 int nimaps; 1189 1189 xfs_bmbt_irec_t imaps[2]; 1190 1190 1191 - if ((ip->i_d.di_mode & S_IFMT) != S_IFREG) 1191 + if (!S_ISREG(ip->i_d.di_mode)) 1192 1192 return; 1193 1193 1194 1194 if (XFS_IS_REALTIME_INODE(ip)) ··· 1828 1828 ASSERT(ip->i_d.di_nextents == 0); 1829 1829 ASSERT(ip->i_d.di_anextents == 0); 1830 1830 ASSERT((ip->i_d.di_size == 0 && ip->i_size == 0) || 1831 - ((ip->i_d.di_mode & S_IFMT) != S_IFREG)); 1831 + (!S_ISREG(ip->i_d.di_mode))); 1832 1832 ASSERT(ip->i_d.di_nblocks == 0); 1833 1833 1834 1834 /* ··· 2671 2671 __func__, ip->i_ino, ip, ip->i_d.di_magic); 2672 2672 goto corrupt_out; 2673 2673 } 2674 - if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) { 2674 + if (S_ISREG(ip->i_d.di_mode)) { 2675 2675 if (XFS_TEST_ERROR( 2676 2676 (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && 2677 2677 (ip->i_d.di_format != XFS_DINODE_FMT_BTREE), ··· 2681 2681 __func__, ip->i_ino, ip); 2682 2682 goto corrupt_out; 2683 2683 } 2684 - } else if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) { 2684 + } else if (S_ISDIR(ip->i_d.di_mode)) { 2685 2685 if (XFS_TEST_ERROR( 2686 2686 (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && 2687 2687 (ip->i_d.di_format != XFS_DINODE_FMT_BTREE) &&
+1 -1
fs/xfs/xfs_inode.h
··· 263 263 struct inode i_vnode; /* embedded VFS inode */ 264 264 } xfs_inode_t; 265 265 266 - #define XFS_ISIZE(ip) (((ip)->i_d.di_mode & S_IFMT) == S_IFREG) ? \ 266 + #define XFS_ISIZE(ip) S_ISREG((ip)->i_d.di_mode) ? \ 267 267 (ip)->i_size : (ip)->i_d.di_size; 268 268 269 269 /* Convert from vfs inode to xfs inode */
+2 -2
fs/xfs/xfs_log_recover.c
··· 2283 2283 /* Take the opportunity to reset the flush iteration count */ 2284 2284 dicp->di_flushiter = 0; 2285 2285 2286 - if (unlikely((dicp->di_mode & S_IFMT) == S_IFREG)) { 2286 + if (unlikely(S_ISREG(dicp->di_mode))) { 2287 2287 if ((dicp->di_format != XFS_DINODE_FMT_EXTENTS) && 2288 2288 (dicp->di_format != XFS_DINODE_FMT_BTREE)) { 2289 2289 XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(3)", ··· 2296 2296 error = EFSCORRUPTED; 2297 2297 goto error; 2298 2298 } 2299 - } else if (unlikely((dicp->di_mode & S_IFMT) == S_IFDIR)) { 2299 + } else if (unlikely(S_ISDIR(dicp->di_mode))) { 2300 2300 if ((dicp->di_format != XFS_DINODE_FMT_EXTENTS) && 2301 2301 (dicp->di_format != XFS_DINODE_FMT_BTREE) && 2302 2302 (dicp->di_format != XFS_DINODE_FMT_LOCAL)) {
+1 -1
fs/xfs/xfs_mount.c
··· 1331 1331 1332 1332 ASSERT(rip != NULL); 1333 1333 1334 - if (unlikely((rip->i_d.di_mode & S_IFMT) != S_IFDIR)) { 1334 + if (unlikely(!S_ISDIR(rip->i_d.di_mode))) { 1335 1335 xfs_warn(mp, "corrupted root inode %llu: not a directory", 1336 1336 (unsigned long long)rip->i_ino); 1337 1337 xfs_iunlock(rip, XFS_ILOCK_EXCL);
+2 -2
fs/xfs/xfs_rename.c
··· 116 116 trace_xfs_rename(src_dp, target_dp, src_name, target_name); 117 117 118 118 new_parent = (src_dp != target_dp); 119 - src_is_directory = ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR); 119 + src_is_directory = S_ISDIR(src_ip->i_d.di_mode); 120 120 121 121 if (src_is_directory) { 122 122 /* ··· 226 226 * target and source are directories and that target can be 227 227 * destroyed, or that neither is a directory. 228 228 */ 229 - if ((target_ip->i_d.di_mode & S_IFMT) == S_IFDIR) { 229 + if (S_ISDIR(target_ip->i_d.di_mode)) { 230 230 /* 231 231 * Make sure target dir is empty. 232 232 */
+5 -5
fs/xfs/xfs_vnodeops.c
··· 121 121 122 122 xfs_ilock(ip, XFS_ILOCK_SHARED); 123 123 124 - ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFLNK); 124 + ASSERT(S_ISLNK(ip->i_d.di_mode)); 125 125 ASSERT(ip->i_d.di_size <= MAXPATHLEN); 126 126 127 127 pathlen = ip->i_d.di_size; ··· 529 529 if (ip->i_d.di_nlink == 0) 530 530 return 0; 531 531 532 - if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) && 532 + if ((S_ISREG(ip->i_d.di_mode) && 533 533 ((ip->i_size > 0) || (VN_CACHED(VFS_I(ip)) > 0 || 534 534 ip->i_delayed_blks > 0)) && 535 535 (ip->i_df.if_flags & XFS_IFEXTENTS)) && ··· 610 610 truncate = ((ip->i_d.di_nlink == 0) && 611 611 ((ip->i_d.di_size != 0) || (ip->i_size != 0) || 612 612 (ip->i_d.di_nextents > 0) || (ip->i_delayed_blks > 0)) && 613 - ((ip->i_d.di_mode & S_IFMT) == S_IFREG)); 613 + S_ISREG(ip->i_d.di_mode)); 614 614 615 615 mp = ip->i_mount; 616 616 ··· 621 621 goto out; 622 622 623 623 if (ip->i_d.di_nlink != 0) { 624 - if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) && 624 + if ((S_ISREG(ip->i_d.di_mode) && 625 625 ((ip->i_size > 0) || (VN_CACHED(VFS_I(ip)) > 0 || 626 626 ip->i_delayed_blks > 0)) && 627 627 (ip->i_df.if_flags & XFS_IFEXTENTS) && ··· 669 669 xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); 670 670 return VN_INACTIVE_CACHE; 671 671 } 672 - } else if ((ip->i_d.di_mode & S_IFMT) == S_IFLNK) { 672 + } else if (S_ISLNK(ip->i_d.di_mode)) { 673 673 674 674 /* 675 675 * If we get an error while cleaning up a
+2 -1
include/linux/fs.h
··· 2310 2310 extern void iget_failed(struct inode *); 2311 2311 extern void end_writeback(struct inode *); 2312 2312 extern void __destroy_inode(struct inode *); 2313 - extern struct inode *new_inode(struct super_block *); 2313 + extern struct inode *new_inode_pseudo(struct super_block *sb); 2314 + extern struct inode *new_inode(struct super_block *sb); 2314 2315 extern void free_inode_nonrcu(struct inode *inode); 2315 2316 extern int should_remove_suid(struct dentry *); 2316 2317 extern int file_remove_suid(struct file *);
+1 -1
net/socket.c
··· 467 467 struct inode *inode; 468 468 struct socket *sock; 469 469 470 - inode = new_inode(sock_mnt->mnt_sb); 470 + inode = new_inode_pseudo(sock_mnt->mnt_sb); 471 471 if (!inode) 472 472 return NULL; 473 473
+1 -1
security/integrity/ima/ima_main.c
··· 86 86 struct inode *inode, 87 87 struct file *file) 88 88 { 89 - mode_t mode = file->f_mode; 89 + fmode_t mode = file->f_mode; 90 90 91 91 mutex_lock(&iint->mutex); 92 92 if (mode & FMODE_WRITE &&
+1 -1
sound/isa/msnd/msnd.h
··· 249 249 250 250 /* State variables */ 251 251 enum { msndClassic, msndPinnacle } type; 252 - mode_t mode; 252 + fmode_t mode; 253 253 unsigned long flags; 254 254 #define F_RESETTING 0 255 255 #define F_HAVEDIGITAL 1