diff options
| -rw-r--r-- | Documentation/filesystems/nfs/Exporting | 9 | ||||
| -rw-r--r-- | drivers/pci/pci-label.c | 2 | ||||
| -rw-r--r-- | fs/anon_inodes.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/inode.c | 4 | ||||
| -rw-r--r-- | fs/dcache.c | 11 | ||||
| -rw-r--r-- | fs/inode.c | 39 | ||||
| -rw-r--r-- | fs/jffs2/fs.c | 2 | ||||
| -rw-r--r-- | fs/omfs/dir.c | 2 | ||||
| -rw-r--r-- | fs/open.c | 78 | ||||
| -rw-r--r-- | fs/pipe.c | 2 | ||||
| -rw-r--r-- | fs/read_write.c | 12 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl.c | 6 | ||||
| -rw-r--r-- | fs/xfs/xfs_bmap.c | 7 | ||||
| -rw-r--r-- | fs/xfs/xfs_dir2.c | 16 | ||||
| -rw-r--r-- | fs/xfs/xfs_filestream.c | 14 | ||||
| -rw-r--r-- | fs/xfs/xfs_inode.c | 16 | ||||
| -rw-r--r-- | fs/xfs/xfs_inode.h | 2 | ||||
| -rw-r--r-- | fs/xfs/xfs_log_recover.c | 4 | ||||
| -rw-r--r-- | fs/xfs/xfs_mount.c | 2 | ||||
| -rw-r--r-- | fs/xfs/xfs_rename.c | 4 | ||||
| -rw-r--r-- | fs/xfs/xfs_vnodeops.c | 10 | ||||
| -rw-r--r-- | include/linux/fs.h | 3 | ||||
| -rw-r--r-- | net/socket.c | 2 | ||||
| -rw-r--r-- | security/integrity/ima/ima_main.c | 2 | ||||
| -rw-r--r-- | sound/isa/msnd/msnd.h | 2 |
25 files changed, 133 insertions, 120 deletions
diff --git a/Documentation/filesystems/nfs/Exporting b/Documentation/filesystems/nfs/Exporting index 87019d2b5981..09994c247289 100644 --- a/Documentation/filesystems/nfs/Exporting +++ b/Documentation/filesystems/nfs/Exporting | |||
| @@ -92,7 +92,14 @@ For a filesystem to be exportable it must: | |||
| 92 | 1/ provide the filehandle fragment routines described below. | 92 | 1/ provide the filehandle fragment routines described below. |
| 93 | 2/ make sure that d_splice_alias is used rather than d_add | 93 | 2/ make sure that d_splice_alias is used rather than d_add |
| 94 | when ->lookup finds an inode for a given parent and name. | 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 | return d_splice_alias(inode, dentry); | 104 | return d_splice_alias(inode, dentry); |
| 98 | } | 105 | } |
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c index 77cb2a14c896..81525ae5d869 100644 --- a/drivers/pci/pci-label.c +++ b/drivers/pci/pci-label.c | |||
| @@ -55,7 +55,7 @@ enum smbios_attr_enum { | |||
| 55 | SMBIOS_ATTR_INSTANCE_SHOW, | 55 | SMBIOS_ATTR_INSTANCE_SHOW, |
| 56 | }; | 56 | }; |
| 57 | 57 | ||
| 58 | static mode_t | 58 | static size_t |
| 59 | find_smbios_instance_string(struct pci_dev *pdev, char *buf, | 59 | find_smbios_instance_string(struct pci_dev *pdev, char *buf, |
| 60 | enum smbios_attr_enum attribute) | 60 | enum smbios_attr_enum attribute) |
| 61 | { | 61 | { |
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c index 4d433d34736f..f11e43ed907d 100644 --- a/fs/anon_inodes.c +++ b/fs/anon_inodes.c | |||
| @@ -187,7 +187,7 @@ EXPORT_SYMBOL_GPL(anon_inode_getfd); | |||
| 187 | */ | 187 | */ |
| 188 | static struct inode *anon_inode_mkinode(void) | 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 | if (!inode) | 192 | if (!inode) |
| 193 | return ERR_PTR(-ENOMEM); | 193 | return ERR_PTR(-ENOMEM); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index e91b097e7252..caa26ab5ed68 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -4467,7 +4467,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
| 4467 | inode->i_generation = BTRFS_I(inode)->generation; | 4467 | inode->i_generation = BTRFS_I(inode)->generation; |
| 4468 | btrfs_set_inode_space_info(root, inode); | 4468 | btrfs_set_inode_space_info(root, inode); |
| 4469 | 4469 | ||
| 4470 | if (mode & S_IFDIR) | 4470 | if (S_ISDIR(mode)) |
| 4471 | owner = 0; | 4471 | owner = 0; |
| 4472 | else | 4472 | else |
| 4473 | owner = 1; | 4473 | owner = 1; |
| @@ -4512,7 +4512,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
| 4512 | 4512 | ||
| 4513 | btrfs_inherit_iflags(inode, dir); | 4513 | btrfs_inherit_iflags(inode, dir); |
| 4514 | 4514 | ||
| 4515 | if ((mode & S_IFREG)) { | 4515 | if (S_ISREG(mode)) { |
| 4516 | if (btrfs_test_opt(root, NODATASUM)) | 4516 | if (btrfs_test_opt(root, NODATASUM)) |
| 4517 | BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM; | 4517 | BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM; |
| 4518 | if (btrfs_test_opt(root, NODATACOW) || | 4518 | if (btrfs_test_opt(root, NODATACOW) || |
diff --git a/fs/dcache.c b/fs/dcache.c index be18598c7fd7..b05aac3a8cfc 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
| @@ -2138,8 +2138,9 @@ static void dentry_unlock_parents_for_move(struct dentry *dentry, | |||
| 2138 | * @target: new dentry | 2138 | * @target: new dentry |
| 2139 | * | 2139 | * |
| 2140 | * Update the dcache to reflect the move of a file name. Negative | 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 | 2141 | * dcache entries should not be moved in this way. Caller must hold |
| 2142 | * rename_lock. | 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 | static void __d_move(struct dentry * dentry, struct dentry * target) | 2145 | static void __d_move(struct dentry * dentry, struct dentry * target) |
| 2145 | { | 2146 | { |
| @@ -2202,7 +2203,8 @@ static void __d_move(struct dentry * dentry, struct dentry * target) | |||
| 2202 | * @target: new dentry | 2203 | * @target: new dentry |
| 2203 | * | 2204 | * |
| 2204 | * Update the dcache to reflect the move of a file name. Negative | 2205 | * Update the dcache to reflect the move of a file name. Negative |
| 2205 | * dcache entries should not be moved in this way. | 2206 | * dcache entries should not be moved in this way. See the locking |
| 2207 | * requirements for __d_move. | ||
| 2206 | */ | 2208 | */ |
| 2207 | void d_move(struct dentry *dentry, struct dentry *target) | 2209 | void d_move(struct dentry *dentry, struct dentry *target) |
| 2208 | { | 2210 | { |
| @@ -2320,7 +2322,8 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) | |||
| 2320 | * @inode: inode to bind to the dentry, to which aliases may be attached | 2322 | * @inode: inode to bind to the dentry, to which aliases may be attached |
| 2321 | * | 2323 | * |
| 2322 | * Introduces an dentry into the tree, substituting an extant disconnected | 2324 | * Introduces an dentry into the tree, substituting an extant disconnected |
| 2323 | * root directory alias in its place if there is one | 2325 | * root directory alias in its place if there is one. Caller must hold the |
| 2326 | * i_mutex of the parent directory. | ||
| 2324 | */ | 2327 | */ |
| 2325 | struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) | 2328 | struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) |
| 2326 | { | 2329 | { |
diff --git a/fs/inode.c b/fs/inode.c index a48fa5355fb4..d0c72ff6b30e 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
| @@ -361,9 +361,11 @@ EXPORT_SYMBOL_GPL(inode_sb_list_add); | |||
| 361 | 361 | ||
| 362 | static inline void inode_sb_list_del(struct inode *inode) | 362 | static inline void inode_sb_list_del(struct inode *inode) |
| 363 | { | 363 | { |
| 364 | spin_lock(&inode_sb_list_lock); | 364 | if (!list_empty(&inode->i_sb_list)) { |
| 365 | list_del_init(&inode->i_sb_list); | 365 | spin_lock(&inode_sb_list_lock); |
| 366 | spin_unlock(&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 | static unsigned long hash(struct super_block *sb, unsigned long hashval) | 371 | static unsigned long hash(struct super_block *sb, unsigned long hashval) |
| @@ -796,6 +798,29 @@ unsigned int get_next_ino(void) | |||
| 796 | EXPORT_SYMBOL(get_next_ino); | 798 | EXPORT_SYMBOL(get_next_ino); |
| 797 | 799 | ||
| 798 | /** | 800 | /** |
| 801 | * new_inode_pseudo - obtain an inode | ||
| 802 | * @sb: superblock | ||
| 803 | * | ||
| 804 | * Allocates a new inode for given superblock. | ||
| 805 | * Inode wont be chained in superblock s_inodes list | ||
| 806 | * This means : | ||
| 807 | * - fs can't be unmount | ||
| 808 | * - quotas, fsnotify, writeback can't work | ||
| 809 | */ | ||
| 810 | struct inode *new_inode_pseudo(struct super_block *sb) | ||
| 811 | { | ||
| 812 | struct inode *inode = alloc_inode(sb); | ||
| 813 | |||
| 814 | if (inode) { | ||
| 815 | spin_lock(&inode->i_lock); | ||
| 816 | inode->i_state = 0; | ||
| 817 | spin_unlock(&inode->i_lock); | ||
| 818 | INIT_LIST_HEAD(&inode->i_sb_list); | ||
| 819 | } | ||
| 820 | return inode; | ||
| 821 | } | ||
| 822 | |||
| 823 | /** | ||
| 799 | * new_inode - obtain an inode | 824 | * new_inode - obtain an inode |
| 800 | * @sb: superblock | 825 | * @sb: superblock |
| 801 | * | 826 | * |
| @@ -813,13 +838,9 @@ struct inode *new_inode(struct super_block *sb) | |||
| 813 | 838 | ||
| 814 | spin_lock_prefetch(&inode_sb_list_lock); | 839 | spin_lock_prefetch(&inode_sb_list_lock); |
| 815 | 840 | ||
| 816 | inode = alloc_inode(sb); | 841 | inode = new_inode_pseudo(sb); |
| 817 | if (inode) { | 842 | if (inode) |
| 818 | spin_lock(&inode->i_lock); | ||
| 819 | inode->i_state = 0; | ||
| 820 | spin_unlock(&inode->i_lock); | ||
| 821 | inode_sb_list_add(inode); | 843 | inode_sb_list_add(inode); |
| 822 | } | ||
| 823 | return inode; | 844 | return inode; |
| 824 | } | 845 | } |
| 825 | EXPORT_SYMBOL(new_inode); | 846 | EXPORT_SYMBOL(new_inode); |
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index eeead33d8ef0..b81b35ddf4e4 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
| @@ -80,7 +80,7 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) | |||
| 80 | ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); | 80 | ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); |
| 81 | if (ret) { | 81 | if (ret) { |
| 82 | jffs2_free_raw_inode(ri); | 82 | jffs2_free_raw_inode(ri); |
| 83 | if (S_ISLNK(inode->i_mode & S_IFMT)) | 83 | if (S_ISLNK(inode->i_mode)) |
| 84 | kfree(mdata); | 84 | kfree(mdata); |
| 85 | return ret; | 85 | return ret; |
| 86 | } | 86 | } |
diff --git a/fs/omfs/dir.c b/fs/omfs/dir.c index 3b8d3979e03b..98e544274390 100644 --- a/fs/omfs/dir.c +++ b/fs/omfs/dir.c | |||
| @@ -93,7 +93,7 @@ int omfs_make_empty(struct inode *inode, struct super_block *sb) | |||
| 93 | 93 | ||
| 94 | memset(bh->b_data, 0, sizeof(struct omfs_inode)); | 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 | memset(&bh->b_data[OMFS_DIR_START], 0xff, | 97 | memset(&bh->b_data[OMFS_DIR_START], 0xff, |
| 98 | sbi->s_sys_blocksize - OMFS_DIR_START); | 98 | sbi->s_sys_blocksize - OMFS_DIR_START); |
| 99 | } else | 99 | } else |
| @@ -446,74 +446,52 @@ out: | |||
| 446 | return error; | 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; | 451 | struct inode *inode = path->dentry->d_inode; |
| 452 | struct dentry * dentry; | ||
| 453 | struct file * file; | ||
| 454 | int err = -EBADF; | ||
| 455 | struct iattr newattrs; | 452 | struct iattr newattrs; |
| 453 | int error; | ||
| 456 | 454 | ||
| 457 | file = fget(fd); | 455 | error = mnt_want_write(path->mnt); |
| 458 | if (!file) | 456 | if (error) |
| 459 | goto out; | 457 | return error; |
| 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; | ||
| 469 | mutex_lock(&inode->i_mutex); | 458 | mutex_lock(&inode->i_mutex); |
| 470 | err = security_path_chmod(dentry, file->f_vfsmnt, mode); | 459 | error = security_path_chmod(path->dentry, path->mnt, mode); |
| 471 | if (err) | 460 | if (error) |
| 472 | goto out_unlock; | 461 | goto out_unlock; |
| 473 | if (mode == (mode_t) -1) | ||
| 474 | mode = inode->i_mode; | ||
| 475 | newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); | 462 | newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); |
| 476 | newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; | 463 | newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; |
| 477 | err = notify_change(dentry, &newattrs); | 464 | error = notify_change(path->dentry, &newattrs); |
| 478 | out_unlock: | 465 | out_unlock: |
| 479 | mutex_unlock(&inode->i_mutex); | 466 | mutex_unlock(&inode->i_mutex); |
| 480 | mnt_drop_write(file->f_path.mnt); | 467 | mnt_drop_write(path->mnt); |
| 481 | out_putf: | 468 | return error; |
| 482 | fput(file); | 469 | } |
| 483 | out: | 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 | return err; | 482 | return err; |
| 485 | } | 483 | } |
| 486 | 484 | ||
| 487 | SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, mode_t, mode) | 485 | SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, mode_t, mode) |
| 488 | { | 486 | { |
| 489 | struct path path; | 487 | struct path path; |
| 490 | struct inode *inode; | ||
| 491 | int error; | 488 | int error; |
| 492 | struct iattr newattrs; | ||
| 493 | 489 | ||
| 494 | error = user_path_at(dfd, filename, LOOKUP_FOLLOW, &path); | 490 | error = user_path_at(dfd, filename, LOOKUP_FOLLOW, &path); |
| 495 | if (error) | 491 | if (!error) { |
| 496 | goto out; | 492 | error = chmod_common(&path, mode); |
| 497 | inode = path.dentry->d_inode; | 493 | path_put(&path); |
| 498 | 494 | } | |
| 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: | ||
| 517 | return error; | 495 | return error; |
| 518 | } | 496 | } |
| 519 | 497 | ||
| @@ -948,7 +948,7 @@ static const struct dentry_operations pipefs_dentry_operations = { | |||
| 948 | 948 | ||
| 949 | static struct inode * get_pipe_inode(void) | 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 | struct pipe_inode_info *pipe; | 952 | struct pipe_inode_info *pipe; |
| 953 | 953 | ||
| 954 | if (!inode) | 954 | if (!inode) |
diff --git a/fs/read_write.c b/fs/read_write.c index 5907b49e4d7e..179f1c33ea57 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
| @@ -166,8 +166,10 @@ loff_t default_llseek(struct file *file, loff_t offset, int origin) | |||
| 166 | * long as offset isn't at the end of the file then the | 166 | * long as offset isn't at the end of the file then the |
| 167 | * offset is data. | 167 | * offset is data. |
| 168 | */ | 168 | */ |
| 169 | if (offset >= inode->i_size) | 169 | if (offset >= inode->i_size) { |
| 170 | return -ENXIO; | 170 | retval = -ENXIO; |
| 171 | goto out; | ||
| 172 | } | ||
| 171 | break; | 173 | break; |
| 172 | case SEEK_HOLE: | 174 | case SEEK_HOLE: |
| 173 | /* | 175 | /* |
| @@ -175,8 +177,10 @@ loff_t default_llseek(struct file *file, loff_t offset, int origin) | |||
| 175 | * as long as offset isn't i_size or larger, return | 177 | * as long as offset isn't i_size or larger, return |
| 176 | * i_size. | 178 | * i_size. |
| 177 | */ | 179 | */ |
| 178 | if (offset >= inode->i_size) | 180 | if (offset >= inode->i_size) { |
| 179 | return -ENXIO; | 181 | retval = -ENXIO; |
| 182 | goto out; | ||
| 183 | } | ||
| 180 | offset = inode->i_size; | 184 | offset = inode->i_size; |
| 181 | break; | 185 | break; |
| 182 | } | 186 | } |
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index acca2c5ca3fa..f7ce7debe14c 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
| @@ -265,7 +265,7 @@ xfs_open_by_handle( | |||
| 265 | return PTR_ERR(filp); | 265 | return PTR_ERR(filp); |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | if (inode->i_mode & S_IFREG) { | 268 | if (S_ISREG(inode->i_mode)) { |
| 269 | filp->f_flags |= O_NOATIME; | 269 | filp->f_flags |= O_NOATIME; |
| 270 | filp->f_mode |= FMODE_NOCMTIME; | 270 | filp->f_mode |= FMODE_NOCMTIME; |
| 271 | } | 271 | } |
| @@ -850,14 +850,14 @@ xfs_set_diflags( | |||
| 850 | di_flags |= XFS_DIFLAG_NODEFRAG; | 850 | di_flags |= XFS_DIFLAG_NODEFRAG; |
| 851 | if (xflags & XFS_XFLAG_FILESTREAM) | 851 | if (xflags & XFS_XFLAG_FILESTREAM) |
| 852 | di_flags |= XFS_DIFLAG_FILESTREAM; | 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 | if (xflags & XFS_XFLAG_RTINHERIT) | 854 | if (xflags & XFS_XFLAG_RTINHERIT) |
| 855 | di_flags |= XFS_DIFLAG_RTINHERIT; | 855 | di_flags |= XFS_DIFLAG_RTINHERIT; |
| 856 | if (xflags & XFS_XFLAG_NOSYMLINKS) | 856 | if (xflags & XFS_XFLAG_NOSYMLINKS) |
| 857 | di_flags |= XFS_DIFLAG_NOSYMLINKS; | 857 | di_flags |= XFS_DIFLAG_NOSYMLINKS; |
| 858 | if (xflags & XFS_XFLAG_EXTSZINHERIT) | 858 | if (xflags & XFS_XFLAG_EXTSZINHERIT) |
| 859 | di_flags |= XFS_DIFLAG_EXTSZINHERIT; | 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 | if (xflags & XFS_XFLAG_REALTIME) | 861 | if (xflags & XFS_XFLAG_REALTIME) |
| 862 | di_flags |= XFS_DIFLAG_REALTIME; | 862 | di_flags |= XFS_DIFLAG_REALTIME; |
| 863 | if (xflags & XFS_XFLAG_EXTSIZE) | 863 | if (xflags & XFS_XFLAG_EXTSIZE) |
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index c51a3f903633..ab3e5c6c4642 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
| @@ -414,7 +414,7 @@ xfs_bmap_add_attrfork_local( | |||
| 414 | 414 | ||
| 415 | if (ip->i_df.if_bytes <= XFS_IFORK_DSIZE(ip)) | 415 | if (ip->i_df.if_bytes <= XFS_IFORK_DSIZE(ip)) |
| 416 | return 0; | 416 | return 0; |
| 417 | if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) { | 417 | if (S_ISDIR(ip->i_d.di_mode)) { |
| 418 | mp = ip->i_mount; | 418 | mp = ip->i_mount; |
| 419 | memset(&dargs, 0, sizeof(dargs)); | 419 | memset(&dargs, 0, sizeof(dargs)); |
| 420 | dargs.dp = ip; | 420 | dargs.dp = ip; |
| @@ -3344,8 +3344,7 @@ xfs_bmap_local_to_extents( | |||
| 3344 | * We don't want to deal with the case of keeping inode data inline yet. | 3344 | * We don't want to deal with the case of keeping inode data inline yet. |
| 3345 | * So sending the data fork of a regular inode is invalid. | 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 && | 3347 | ASSERT(!(S_ISREG(ip->i_d.di_mode) && whichfork == XFS_DATA_FORK)); |
| 3348 | whichfork == XFS_DATA_FORK)); | ||
| 3349 | ifp = XFS_IFORK_PTR(ip, whichfork); | 3348 | ifp = XFS_IFORK_PTR(ip, whichfork); |
| 3350 | ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL); | 3349 | ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL); |
| 3351 | flags = 0; | 3350 | flags = 0; |
| @@ -4052,7 +4051,7 @@ xfs_bmap_one_block( | |||
| 4052 | 4051 | ||
| 4053 | #ifndef DEBUG | 4052 | #ifndef DEBUG |
| 4054 | if (whichfork == XFS_DATA_FORK) { | 4053 | if (whichfork == XFS_DATA_FORK) { |
| 4055 | return ((ip->i_d.di_mode & S_IFMT) == S_IFREG) ? | 4054 | return S_ISREG(ip->i_d.di_mode) ? |
| 4056 | (ip->i_size == ip->i_mount->m_sb.sb_blocksize) : | 4055 | (ip->i_size == ip->i_mount->m_sb.sb_blocksize) : |
| 4057 | (ip->i_d.di_size == ip->i_mount->m_sb.sb_blocksize); | 4056 | (ip->i_d.di_size == ip->i_mount->m_sb.sb_blocksize); |
| 4058 | } | 4057 | } |
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c index 4580ce00aeb4..a2e27010c7fb 100644 --- a/fs/xfs/xfs_dir2.c +++ b/fs/xfs/xfs_dir2.c | |||
| @@ -121,7 +121,7 @@ xfs_dir_isempty( | |||
| 121 | { | 121 | { |
| 122 | xfs_dir2_sf_hdr_t *sfp; | 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 | if (dp->i_d.di_size == 0) /* might happen during shutdown. */ | 125 | if (dp->i_d.di_size == 0) /* might happen during shutdown. */ |
| 126 | return 1; | 126 | return 1; |
| 127 | if (dp->i_d.di_size > XFS_IFORK_DSIZE(dp)) | 127 | if (dp->i_d.di_size > XFS_IFORK_DSIZE(dp)) |
| @@ -179,7 +179,7 @@ xfs_dir_init( | |||
| 179 | memset((char *)&args, 0, sizeof(args)); | 179 | memset((char *)&args, 0, sizeof(args)); |
| 180 | args.dp = dp; | 180 | args.dp = dp; |
| 181 | args.trans = tp; | 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 | if ((error = xfs_dir_ino_validate(tp->t_mountp, pdp->i_ino))) | 183 | if ((error = xfs_dir_ino_validate(tp->t_mountp, pdp->i_ino))) |
| 184 | return error; | 184 | return error; |
| 185 | return xfs_dir2_sf_create(&args, pdp->i_ino); | 185 | return xfs_dir2_sf_create(&args, pdp->i_ino); |
| @@ -202,7 +202,7 @@ xfs_dir_createname( | |||
| 202 | int rval; | 202 | int rval; |
| 203 | int v; /* type-checking value */ | 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 | if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) | 206 | if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) |
| 207 | return rval; | 207 | return rval; |
| 208 | XFS_STATS_INC(xs_dir_create); | 208 | XFS_STATS_INC(xs_dir_create); |
| @@ -278,7 +278,7 @@ xfs_dir_lookup( | |||
| 278 | int rval; | 278 | int rval; |
| 279 | int v; /* type-checking value */ | 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 | XFS_STATS_INC(xs_dir_lookup); | 282 | XFS_STATS_INC(xs_dir_lookup); |
| 283 | 283 | ||
| 284 | memset(&args, 0, sizeof(xfs_da_args_t)); | 284 | memset(&args, 0, sizeof(xfs_da_args_t)); |
| @@ -333,7 +333,7 @@ xfs_dir_removename( | |||
| 333 | int rval; | 333 | int rval; |
| 334 | int v; /* type-checking value */ | 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 | XFS_STATS_INC(xs_dir_remove); | 337 | XFS_STATS_INC(xs_dir_remove); |
| 338 | 338 | ||
| 339 | memset(&args, 0, sizeof(xfs_da_args_t)); | 339 | memset(&args, 0, sizeof(xfs_da_args_t)); |
| @@ -382,7 +382,7 @@ xfs_readdir( | |||
| 382 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) | 382 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) |
| 383 | return XFS_ERROR(EIO); | 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 | XFS_STATS_INC(xs_dir_getdents); | 386 | XFS_STATS_INC(xs_dir_getdents); |
| 387 | 387 | ||
| 388 | if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) | 388 | if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) |
| @@ -414,7 +414,7 @@ xfs_dir_replace( | |||
| 414 | int rval; | 414 | int rval; |
| 415 | int v; /* type-checking value */ | 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 | if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) | 419 | if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) |
| 420 | return rval; | 420 | return rval; |
| @@ -464,7 +464,7 @@ xfs_dir_canenter( | |||
| 464 | if (resblks) | 464 | if (resblks) |
| 465 | return 0; | 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 | memset(&args, 0, sizeof(xfs_da_args_t)); | 469 | memset(&args, 0, sizeof(xfs_da_args_t)); |
| 470 | args.name = name->name; | 470 | args.name = name->name; |
diff --git a/fs/xfs/xfs_filestream.c b/fs/xfs/xfs_filestream.c index 9124425b7f2f..3ff3d9e23ded 100644 --- a/fs/xfs/xfs_filestream.c +++ b/fs/xfs/xfs_filestream.c | |||
| @@ -344,9 +344,9 @@ _xfs_filestream_update_ag( | |||
| 344 | * Either ip is a regular file and pip is a directory, or ip is a | 344 | * Either ip is a regular file and pip is a directory, or ip is a |
| 345 | * directory and pip is NULL. | 345 | * directory and pip is NULL. |
| 346 | */ | 346 | */ |
| 347 | ASSERT(ip && (((ip->i_d.di_mode & S_IFREG) && pip && | 347 | ASSERT(ip && ((S_ISREG(ip->i_d.di_mode) && pip && |
| 348 | (pip->i_d.di_mode & S_IFDIR)) || | 348 | S_ISDIR(pip->i_d.di_mode)) || |
| 349 | ((ip->i_d.di_mode & S_IFDIR) && !pip))); | 349 | (S_ISDIR(ip->i_d.di_mode) && !pip))); |
| 350 | 350 | ||
| 351 | mp = ip->i_mount; | 351 | mp = ip->i_mount; |
| 352 | cache = mp->m_filestream; | 352 | cache = mp->m_filestream; |
| @@ -537,7 +537,7 @@ xfs_filestream_lookup_ag( | |||
| 537 | xfs_agnumber_t ag; | 537 | xfs_agnumber_t ag; |
| 538 | int ref; | 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 | ASSERT(0); | 541 | ASSERT(0); |
| 542 | return NULLAGNUMBER; | 542 | return NULLAGNUMBER; |
| 543 | } | 543 | } |
| @@ -579,9 +579,9 @@ xfs_filestream_associate( | |||
| 579 | xfs_agnumber_t ag, rotorstep, startag; | 579 | xfs_agnumber_t ag, rotorstep, startag; |
| 580 | int err = 0; | 580 | int err = 0; |
| 581 | 581 | ||
| 582 | ASSERT(pip->i_d.di_mode & S_IFDIR); | 582 | ASSERT(S_ISDIR(pip->i_d.di_mode)); |
| 583 | ASSERT(ip->i_d.di_mode & S_IFREG); | 583 | ASSERT(S_ISREG(ip->i_d.di_mode)); |
| 584 | if (!(pip->i_d.di_mode & S_IFDIR) || !(ip->i_d.di_mode & S_IFREG)) | 584 | if (!S_ISDIR(pip->i_d.di_mode) || !S_ISREG(ip->i_d.di_mode)) |
| 585 | return -EINVAL; | 585 | return -EINVAL; |
| 586 | 586 | ||
| 587 | mp = pip->i_mount; | 587 | mp = pip->i_mount; |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 3cc21ddf9f7e..2fcca4b03ed3 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
| @@ -368,7 +368,7 @@ xfs_iformat( | |||
| 368 | /* | 368 | /* |
| 369 | * no local regular files yet | 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 | xfs_warn(ip->i_mount, | 372 | xfs_warn(ip->i_mount, |
| 373 | "corrupt inode %Lu (local format for regular file).", | 373 | "corrupt inode %Lu (local format for regular file).", |
| 374 | (unsigned long long) ip->i_ino); | 374 | (unsigned long long) ip->i_ino); |
| @@ -1040,7 +1040,7 @@ xfs_ialloc( | |||
| 1040 | 1040 | ||
| 1041 | if (pip && XFS_INHERIT_GID(pip)) { | 1041 | if (pip && XFS_INHERIT_GID(pip)) { |
| 1042 | ip->i_d.di_gid = pip->i_d.di_gid; | 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 | ip->i_d.di_mode |= S_ISGID; | 1044 | ip->i_d.di_mode |= S_ISGID; |
| 1045 | } | 1045 | } |
| 1046 | } | 1046 | } |
| @@ -1097,14 +1097,14 @@ xfs_ialloc( | |||
| 1097 | if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) { | 1097 | if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) { |
| 1098 | uint di_flags = 0; | 1098 | uint di_flags = 0; |
| 1099 | 1099 | ||
| 1100 | if ((mode & S_IFMT) == S_IFDIR) { | 1100 | if (S_ISDIR(mode)) { |
| 1101 | if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) | 1101 | if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) |
| 1102 | di_flags |= XFS_DIFLAG_RTINHERIT; | 1102 | di_flags |= XFS_DIFLAG_RTINHERIT; |
| 1103 | if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) { | 1103 | if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) { |
| 1104 | di_flags |= XFS_DIFLAG_EXTSZINHERIT; | 1104 | di_flags |= XFS_DIFLAG_EXTSZINHERIT; |
| 1105 | ip->i_d.di_extsize = pip->i_d.di_extsize; | 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 | if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) | 1108 | if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) |
| 1109 | di_flags |= XFS_DIFLAG_REALTIME; | 1109 | di_flags |= XFS_DIFLAG_REALTIME; |
| 1110 | if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) { | 1110 | if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) { |
| @@ -1188,7 +1188,7 @@ xfs_isize_check( | |||
| 1188 | int nimaps; | 1188 | int nimaps; |
| 1189 | xfs_bmbt_irec_t imaps[2]; | 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 | return; | 1192 | return; |
| 1193 | 1193 | ||
| 1194 | if (XFS_IS_REALTIME_INODE(ip)) | 1194 | if (XFS_IS_REALTIME_INODE(ip)) |
| @@ -1828,7 +1828,7 @@ xfs_ifree( | |||
| 1828 | ASSERT(ip->i_d.di_nextents == 0); | 1828 | ASSERT(ip->i_d.di_nextents == 0); |
| 1829 | ASSERT(ip->i_d.di_anextents == 0); | 1829 | ASSERT(ip->i_d.di_anextents == 0); |
| 1830 | ASSERT((ip->i_d.di_size == 0 && ip->i_size == 0) || | 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 | ASSERT(ip->i_d.di_nblocks == 0); | 1832 | ASSERT(ip->i_d.di_nblocks == 0); |
| 1833 | 1833 | ||
| 1834 | /* | 1834 | /* |
| @@ -2671,7 +2671,7 @@ xfs_iflush_int( | |||
| 2671 | __func__, ip->i_ino, ip, ip->i_d.di_magic); | 2671 | __func__, ip->i_ino, ip, ip->i_d.di_magic); |
| 2672 | goto corrupt_out; | 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 | if (XFS_TEST_ERROR( | 2675 | if (XFS_TEST_ERROR( |
| 2676 | (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && | 2676 | (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && |
| 2677 | (ip->i_d.di_format != XFS_DINODE_FMT_BTREE), | 2677 | (ip->i_d.di_format != XFS_DINODE_FMT_BTREE), |
| @@ -2681,7 +2681,7 @@ xfs_iflush_int( | |||
| 2681 | __func__, ip->i_ino, ip); | 2681 | __func__, ip->i_ino, ip); |
| 2682 | goto corrupt_out; | 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 | if (XFS_TEST_ERROR( | 2685 | if (XFS_TEST_ERROR( |
| 2686 | (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && | 2686 | (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && |
| 2687 | (ip->i_d.di_format != XFS_DINODE_FMT_BTREE) && | 2687 | (ip->i_d.di_format != XFS_DINODE_FMT_BTREE) && |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index a97644ab945a..2380a4bcbece 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
| @@ -263,7 +263,7 @@ typedef struct xfs_inode { | |||
| 263 | struct inode i_vnode; /* embedded VFS inode */ | 263 | struct inode i_vnode; /* embedded VFS inode */ |
| 264 | } xfs_inode_t; | 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 | (ip)->i_size : (ip)->i_d.di_size; | 267 | (ip)->i_size : (ip)->i_d.di_size; |
| 268 | 268 | ||
| 269 | /* Convert from vfs inode to xfs inode */ | 269 | /* Convert from vfs inode to xfs inode */ |
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 8fe4206de057..052a2c0ec5fb 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
| @@ -2283,7 +2283,7 @@ xlog_recover_inode_pass2( | |||
| 2283 | /* Take the opportunity to reset the flush iteration count */ | 2283 | /* Take the opportunity to reset the flush iteration count */ |
| 2284 | dicp->di_flushiter = 0; | 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 | if ((dicp->di_format != XFS_DINODE_FMT_EXTENTS) && | 2287 | if ((dicp->di_format != XFS_DINODE_FMT_EXTENTS) && |
| 2288 | (dicp->di_format != XFS_DINODE_FMT_BTREE)) { | 2288 | (dicp->di_format != XFS_DINODE_FMT_BTREE)) { |
| 2289 | XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(3)", | 2289 | XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(3)", |
| @@ -2296,7 +2296,7 @@ xlog_recover_inode_pass2( | |||
| 2296 | error = EFSCORRUPTED; | 2296 | error = EFSCORRUPTED; |
| 2297 | goto error; | 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 | if ((dicp->di_format != XFS_DINODE_FMT_EXTENTS) && | 2300 | if ((dicp->di_format != XFS_DINODE_FMT_EXTENTS) && |
| 2301 | (dicp->di_format != XFS_DINODE_FMT_BTREE) && | 2301 | (dicp->di_format != XFS_DINODE_FMT_BTREE) && |
| 2302 | (dicp->di_format != XFS_DINODE_FMT_LOCAL)) { | 2302 | (dicp->di_format != XFS_DINODE_FMT_LOCAL)) { |
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 7f25245da289..092e16ae4d9d 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
| @@ -1331,7 +1331,7 @@ xfs_mountfs( | |||
| 1331 | 1331 | ||
| 1332 | ASSERT(rip != NULL); | 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 | xfs_warn(mp, "corrupted root inode %llu: not a directory", | 1335 | xfs_warn(mp, "corrupted root inode %llu: not a directory", |
| 1336 | (unsigned long long)rip->i_ino); | 1336 | (unsigned long long)rip->i_ino); |
| 1337 | xfs_iunlock(rip, XFS_ILOCK_EXCL); | 1337 | xfs_iunlock(rip, XFS_ILOCK_EXCL); |
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c index 77a59891734e..df78c297d1a1 100644 --- a/fs/xfs/xfs_rename.c +++ b/fs/xfs/xfs_rename.c | |||
| @@ -116,7 +116,7 @@ xfs_rename( | |||
| 116 | trace_xfs_rename(src_dp, target_dp, src_name, target_name); | 116 | trace_xfs_rename(src_dp, target_dp, src_name, target_name); |
| 117 | 117 | ||
| 118 | new_parent = (src_dp != target_dp); | 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 | if (src_is_directory) { | 121 | if (src_is_directory) { |
| 122 | /* | 122 | /* |
| @@ -226,7 +226,7 @@ xfs_rename( | |||
| 226 | * target and source are directories and that target can be | 226 | * target and source are directories and that target can be |
| 227 | * destroyed, or that neither is a directory. | 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 | * Make sure target dir is empty. | 231 | * Make sure target dir is empty. |
| 232 | */ | 232 | */ |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 88d121486c52..9322e13f0c63 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
| @@ -121,7 +121,7 @@ xfs_readlink( | |||
| 121 | 121 | ||
| 122 | xfs_ilock(ip, XFS_ILOCK_SHARED); | 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 | ASSERT(ip->i_d.di_size <= MAXPATHLEN); | 125 | ASSERT(ip->i_d.di_size <= MAXPATHLEN); |
| 126 | 126 | ||
| 127 | pathlen = ip->i_d.di_size; | 127 | pathlen = ip->i_d.di_size; |
| @@ -529,7 +529,7 @@ xfs_release( | |||
| 529 | if (ip->i_d.di_nlink == 0) | 529 | if (ip->i_d.di_nlink == 0) |
| 530 | return 0; | 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 | ((ip->i_size > 0) || (VN_CACHED(VFS_I(ip)) > 0 || | 533 | ((ip->i_size > 0) || (VN_CACHED(VFS_I(ip)) > 0 || |
| 534 | ip->i_delayed_blks > 0)) && | 534 | ip->i_delayed_blks > 0)) && |
| 535 | (ip->i_df.if_flags & XFS_IFEXTENTS)) && | 535 | (ip->i_df.if_flags & XFS_IFEXTENTS)) && |
| @@ -610,7 +610,7 @@ xfs_inactive( | |||
| 610 | truncate = ((ip->i_d.di_nlink == 0) && | 610 | truncate = ((ip->i_d.di_nlink == 0) && |
| 611 | ((ip->i_d.di_size != 0) || (ip->i_size != 0) || | 611 | ((ip->i_d.di_size != 0) || (ip->i_size != 0) || |
| 612 | (ip->i_d.di_nextents > 0) || (ip->i_delayed_blks > 0)) && | 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 | mp = ip->i_mount; | 615 | mp = ip->i_mount; |
| 616 | 616 | ||
| @@ -621,7 +621,7 @@ xfs_inactive( | |||
| 621 | goto out; | 621 | goto out; |
| 622 | 622 | ||
| 623 | if (ip->i_d.di_nlink != 0) { | 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 | ((ip->i_size > 0) || (VN_CACHED(VFS_I(ip)) > 0 || | 625 | ((ip->i_size > 0) || (VN_CACHED(VFS_I(ip)) > 0 || |
| 626 | ip->i_delayed_blks > 0)) && | 626 | ip->i_delayed_blks > 0)) && |
| 627 | (ip->i_df.if_flags & XFS_IFEXTENTS) && | 627 | (ip->i_df.if_flags & XFS_IFEXTENTS) && |
| @@ -669,7 +669,7 @@ xfs_inactive( | |||
| 669 | xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); | 669 | xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); |
| 670 | return VN_INACTIVE_CACHE; | 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 | * If we get an error while cleaning up a | 675 | * If we get an error while cleaning up a |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 5f523eb9bb8d..f23bcb77260c 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -2310,7 +2310,8 @@ extern void __iget(struct inode * inode); | |||
| 2310 | extern void iget_failed(struct inode *); | 2310 | extern void iget_failed(struct inode *); |
| 2311 | extern void end_writeback(struct inode *); | 2311 | extern void end_writeback(struct inode *); |
| 2312 | extern void __destroy_inode(struct inode *); | 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 | extern void free_inode_nonrcu(struct inode *inode); | 2315 | extern void free_inode_nonrcu(struct inode *inode); |
| 2315 | extern int should_remove_suid(struct dentry *); | 2316 | extern int should_remove_suid(struct dentry *); |
| 2316 | extern int file_remove_suid(struct file *); | 2317 | extern int file_remove_suid(struct file *); |
diff --git a/net/socket.c b/net/socket.c index 02dc82db3d23..26ed35c7751e 100644 --- a/net/socket.c +++ b/net/socket.c | |||
| @@ -467,7 +467,7 @@ static struct socket *sock_alloc(void) | |||
| 467 | struct inode *inode; | 467 | struct inode *inode; |
| 468 | struct socket *sock; | 468 | struct socket *sock; |
| 469 | 469 | ||
| 470 | inode = new_inode(sock_mnt->mnt_sb); | 470 | inode = new_inode_pseudo(sock_mnt->mnt_sb); |
| 471 | if (!inode) | 471 | if (!inode) |
| 472 | return NULL; | 472 | return NULL; |
| 473 | 473 | ||
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index 39d66dc2b8e9..26b46ff74663 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c | |||
| @@ -86,7 +86,7 @@ static void ima_check_last_writer(struct ima_iint_cache *iint, | |||
| 86 | struct inode *inode, | 86 | struct inode *inode, |
| 87 | struct file *file) | 87 | struct file *file) |
| 88 | { | 88 | { |
| 89 | mode_t mode = file->f_mode; | 89 | fmode_t mode = file->f_mode; |
| 90 | 90 | ||
| 91 | mutex_lock(&iint->mutex); | 91 | mutex_lock(&iint->mutex); |
| 92 | if (mode & FMODE_WRITE && | 92 | if (mode & FMODE_WRITE && |
diff --git a/sound/isa/msnd/msnd.h b/sound/isa/msnd/msnd.h index 3773e242b58e..a168ba3313ac 100644 --- a/sound/isa/msnd/msnd.h +++ b/sound/isa/msnd/msnd.h | |||
| @@ -249,7 +249,7 @@ struct snd_msnd { | |||
| 249 | 249 | ||
| 250 | /* State variables */ | 250 | /* State variables */ |
| 251 | enum { msndClassic, msndPinnacle } type; | 251 | enum { msndClassic, msndPinnacle } type; |
| 252 | mode_t mode; | 252 | fmode_t mode; |
| 253 | unsigned long flags; | 253 | unsigned long flags; |
| 254 | #define F_RESETTING 0 | 254 | #define F_RESETTING 0 |
| 255 | #define F_HAVEDIGITAL 1 | 255 | #define F_HAVEDIGITAL 1 |
