diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-07 17:25:22 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-07 17:25:22 -0500 |
| commit | 6fbac201f95c03e4dbbd207caddaea8a00a78526 (patch) | |
| tree | f13d00e4cc6da481de74063c44cb53387c8cc0e8 | |
| parent | fe803f862804065af4f856764cd85cafa01fe794 (diff) | |
| parent | c472c07bfed9c87d7e0b2c052d7e77fedd7109a9 (diff) | |
Merge tag 'iversion-v4.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux
Pull inode->i_version cleanup from Jeff Layton:
"Goffredo went ahead and sent a patch to rename this function, and
reverse its sense, as we discussed last week.
The patch is very straightforward and I figure it's probably best to
go ahead and merge this to get the API as settled as possible"
* tag 'iversion-v4.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux:
iversion: Rename make inode_cmp_iversion{+raw} to inode_eq_iversion{+raw}
| -rw-r--r-- | fs/affs/dir.c | 2 | ||||
| -rw-r--r-- | fs/exofs/dir.c | 2 | ||||
| -rw-r--r-- | fs/ext2/dir.c | 2 | ||||
| -rw-r--r-- | fs/ext4/dir.c | 4 | ||||
| -rw-r--r-- | fs/ext4/inline.c | 2 | ||||
| -rw-r--r-- | fs/fat/namei_vfat.c | 2 | ||||
| -rw-r--r-- | fs/nfs/inode.c | 6 | ||||
| -rw-r--r-- | fs/ocfs2/dir.c | 4 | ||||
| -rw-r--r-- | fs/ufs/dir.c | 2 | ||||
| -rw-r--r-- | include/linux/iversion.h | 22 | ||||
| -rw-r--r-- | security/integrity/ima/ima_main.c | 2 |
11 files changed, 25 insertions, 25 deletions
diff --git a/fs/affs/dir.c b/fs/affs/dir.c index d180b46453cf..b2bf7016e1b3 100644 --- a/fs/affs/dir.c +++ b/fs/affs/dir.c | |||
| @@ -81,7 +81,7 @@ affs_readdir(struct file *file, struct dir_context *ctx) | |||
| 81 | * we can jump directly to where we left off. | 81 | * we can jump directly to where we left off. |
| 82 | */ | 82 | */ |
| 83 | ino = (u32)(long)file->private_data; | 83 | ino = (u32)(long)file->private_data; |
| 84 | if (ino && inode_cmp_iversion(inode, file->f_version) == 0) { | 84 | if (ino && inode_eq_iversion(inode, file->f_version)) { |
| 85 | pr_debug("readdir() left off=%d\n", ino); | 85 | pr_debug("readdir() left off=%d\n", ino); |
| 86 | goto inside; | 86 | goto inside; |
| 87 | } | 87 | } |
diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c index c5a53fcc43ea..f0138674c1ed 100644 --- a/fs/exofs/dir.c +++ b/fs/exofs/dir.c | |||
| @@ -242,7 +242,7 @@ exofs_readdir(struct file *file, struct dir_context *ctx) | |||
| 242 | unsigned long n = pos >> PAGE_SHIFT; | 242 | unsigned long n = pos >> PAGE_SHIFT; |
| 243 | unsigned long npages = dir_pages(inode); | 243 | unsigned long npages = dir_pages(inode); |
| 244 | unsigned chunk_mask = ~(exofs_chunk_size(inode)-1); | 244 | unsigned chunk_mask = ~(exofs_chunk_size(inode)-1); |
| 245 | bool need_revalidate = inode_cmp_iversion(inode, file->f_version); | 245 | bool need_revalidate = !inode_eq_iversion(inode, file->f_version); |
| 246 | 246 | ||
| 247 | if (pos > inode->i_size - EXOFS_DIR_REC_LEN(1)) | 247 | if (pos > inode->i_size - EXOFS_DIR_REC_LEN(1)) |
| 248 | return 0; | 248 | return 0; |
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index 4111085a129f..3b8114def693 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c | |||
| @@ -294,7 +294,7 @@ ext2_readdir(struct file *file, struct dir_context *ctx) | |||
| 294 | unsigned long npages = dir_pages(inode); | 294 | unsigned long npages = dir_pages(inode); |
| 295 | unsigned chunk_mask = ~(ext2_chunk_size(inode)-1); | 295 | unsigned chunk_mask = ~(ext2_chunk_size(inode)-1); |
| 296 | unsigned char *types = NULL; | 296 | unsigned char *types = NULL; |
| 297 | bool need_revalidate = inode_cmp_iversion(inode, file->f_version); | 297 | bool need_revalidate = !inode_eq_iversion(inode, file->f_version); |
| 298 | 298 | ||
| 299 | if (pos > inode->i_size - EXT2_DIR_REC_LEN(1)) | 299 | if (pos > inode->i_size - EXT2_DIR_REC_LEN(1)) |
| 300 | return 0; | 300 | return 0; |
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index afda0a0499ce..da87cf757f7d 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c | |||
| @@ -209,7 +209,7 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx) | |||
| 209 | * readdir(2), then we might be pointing to an invalid | 209 | * readdir(2), then we might be pointing to an invalid |
| 210 | * dirent right now. Scan from the start of the block | 210 | * dirent right now. Scan from the start of the block |
| 211 | * to make sure. */ | 211 | * to make sure. */ |
| 212 | if (inode_cmp_iversion(inode, file->f_version)) { | 212 | if (!inode_eq_iversion(inode, file->f_version)) { |
| 213 | for (i = 0; i < sb->s_blocksize && i < offset; ) { | 213 | for (i = 0; i < sb->s_blocksize && i < offset; ) { |
| 214 | de = (struct ext4_dir_entry_2 *) | 214 | de = (struct ext4_dir_entry_2 *) |
| 215 | (bh->b_data + i); | 215 | (bh->b_data + i); |
| @@ -569,7 +569,7 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx) | |||
| 569 | * cached entries. | 569 | * cached entries. |
| 570 | */ | 570 | */ |
| 571 | if ((!info->curr_node) || | 571 | if ((!info->curr_node) || |
| 572 | inode_cmp_iversion(inode, file->f_version)) { | 572 | !inode_eq_iversion(inode, file->f_version)) { |
| 573 | info->curr_node = NULL; | 573 | info->curr_node = NULL; |
| 574 | free_rb_tree_fname(&info->root); | 574 | free_rb_tree_fname(&info->root); |
| 575 | file->f_version = inode_query_iversion(inode); | 575 | file->f_version = inode_query_iversion(inode); |
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 7c4165b88505..70cf4c7b268a 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c | |||
| @@ -1487,7 +1487,7 @@ int ext4_read_inline_dir(struct file *file, | |||
| 1487 | * dirent right now. Scan from the start of the inline | 1487 | * dirent right now. Scan from the start of the inline |
| 1488 | * dir to make sure. | 1488 | * dir to make sure. |
| 1489 | */ | 1489 | */ |
| 1490 | if (inode_cmp_iversion(inode, file->f_version)) { | 1490 | if (!inode_eq_iversion(inode, file->f_version)) { |
| 1491 | for (i = 0; i < extra_size && i < offset;) { | 1491 | for (i = 0; i < extra_size && i < offset;) { |
| 1492 | /* | 1492 | /* |
| 1493 | * "." is with offset 0 and | 1493 | * "." is with offset 0 and |
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index cefea792cde8..2649759c478a 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
| @@ -46,7 +46,7 @@ static int vfat_revalidate_shortname(struct dentry *dentry) | |||
| 46 | { | 46 | { |
| 47 | int ret = 1; | 47 | int ret = 1; |
| 48 | spin_lock(&dentry->d_lock); | 48 | spin_lock(&dentry->d_lock); |
| 49 | if (inode_cmp_iversion(d_inode(dentry->d_parent), vfat_d_version(dentry))) | 49 | if (!inode_eq_iversion(d_inode(dentry->d_parent), vfat_d_version(dentry))) |
| 50 | ret = 0; | 50 | ret = 0; |
| 51 | spin_unlock(&dentry->d_lock); | 51 | spin_unlock(&dentry->d_lock); |
| 52 | return ret; | 52 | return ret; |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index ceeaf0fb6657..7d893543cf3b 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
| @@ -1314,7 +1314,7 @@ static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr | |||
| 1314 | 1314 | ||
| 1315 | if ((fattr->valid & NFS_ATTR_FATTR_PRECHANGE) | 1315 | if ((fattr->valid & NFS_ATTR_FATTR_PRECHANGE) |
| 1316 | && (fattr->valid & NFS_ATTR_FATTR_CHANGE) | 1316 | && (fattr->valid & NFS_ATTR_FATTR_CHANGE) |
| 1317 | && !inode_cmp_iversion_raw(inode, fattr->pre_change_attr)) { | 1317 | && inode_eq_iversion_raw(inode, fattr->pre_change_attr)) { |
| 1318 | inode_set_iversion_raw(inode, fattr->change_attr); | 1318 | inode_set_iversion_raw(inode, fattr->change_attr); |
| 1319 | if (S_ISDIR(inode->i_mode)) | 1319 | if (S_ISDIR(inode->i_mode)) |
| 1320 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA); | 1320 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA); |
| @@ -1373,7 +1373,7 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat | |||
| 1373 | 1373 | ||
| 1374 | if (!nfs_file_has_buffered_writers(nfsi)) { | 1374 | if (!nfs_file_has_buffered_writers(nfsi)) { |
| 1375 | /* Verify a few of the more important attributes */ | 1375 | /* Verify a few of the more important attributes */ |
| 1376 | if ((fattr->valid & NFS_ATTR_FATTR_CHANGE) != 0 && inode_cmp_iversion_raw(inode, fattr->change_attr)) | 1376 | if ((fattr->valid & NFS_ATTR_FATTR_CHANGE) != 0 && !inode_eq_iversion_raw(inode, fattr->change_attr)) |
| 1377 | invalid |= NFS_INO_INVALID_ATTR | NFS_INO_REVAL_PAGECACHE; | 1377 | invalid |= NFS_INO_INVALID_ATTR | NFS_INO_REVAL_PAGECACHE; |
| 1378 | 1378 | ||
| 1379 | if ((fattr->valid & NFS_ATTR_FATTR_MTIME) && !timespec_equal(&inode->i_mtime, &fattr->mtime)) | 1379 | if ((fattr->valid & NFS_ATTR_FATTR_MTIME) && !timespec_equal(&inode->i_mtime, &fattr->mtime)) |
| @@ -1803,7 +1803,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
| 1803 | 1803 | ||
| 1804 | /* More cache consistency checks */ | 1804 | /* More cache consistency checks */ |
| 1805 | if (fattr->valid & NFS_ATTR_FATTR_CHANGE) { | 1805 | if (fattr->valid & NFS_ATTR_FATTR_CHANGE) { |
| 1806 | if (inode_cmp_iversion_raw(inode, fattr->change_attr)) { | 1806 | if (!inode_eq_iversion_raw(inode, fattr->change_attr)) { |
| 1807 | dprintk("NFS: change_attr change on server for file %s/%ld\n", | 1807 | dprintk("NFS: change_attr change on server for file %s/%ld\n", |
| 1808 | inode->i_sb->s_id, inode->i_ino); | 1808 | inode->i_sb->s_id, inode->i_ino); |
| 1809 | /* Could it be a race with writeback? */ | 1809 | /* Could it be a race with writeback? */ |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index b7520e20a770..977763d4c27d 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
| @@ -1776,7 +1776,7 @@ static int ocfs2_dir_foreach_blk_id(struct inode *inode, | |||
| 1776 | * readdir(2), then we might be pointing to an invalid | 1776 | * readdir(2), then we might be pointing to an invalid |
| 1777 | * dirent right now. Scan from the start of the block | 1777 | * dirent right now. Scan from the start of the block |
| 1778 | * to make sure. */ | 1778 | * to make sure. */ |
| 1779 | if (inode_cmp_iversion(inode, *f_version)) { | 1779 | if (!inode_eq_iversion(inode, *f_version)) { |
| 1780 | for (i = 0; i < i_size_read(inode) && i < offset; ) { | 1780 | for (i = 0; i < i_size_read(inode) && i < offset; ) { |
| 1781 | de = (struct ocfs2_dir_entry *) | 1781 | de = (struct ocfs2_dir_entry *) |
| 1782 | (data->id_data + i); | 1782 | (data->id_data + i); |
| @@ -1870,7 +1870,7 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode, | |||
| 1870 | * readdir(2), then we might be pointing to an invalid | 1870 | * readdir(2), then we might be pointing to an invalid |
| 1871 | * dirent right now. Scan from the start of the block | 1871 | * dirent right now. Scan from the start of the block |
| 1872 | * to make sure. */ | 1872 | * to make sure. */ |
| 1873 | if (inode_cmp_iversion(inode, *f_version)) { | 1873 | if (!inode_eq_iversion(inode, *f_version)) { |
| 1874 | for (i = 0; i < sb->s_blocksize && i < offset; ) { | 1874 | for (i = 0; i < sb->s_blocksize && i < offset; ) { |
| 1875 | de = (struct ocfs2_dir_entry *) (bh->b_data + i); | 1875 | de = (struct ocfs2_dir_entry *) (bh->b_data + i); |
| 1876 | /* It's too expensive to do a full | 1876 | /* It's too expensive to do a full |
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index 50dfce000864..b721d0bda5e5 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c | |||
| @@ -429,7 +429,7 @@ ufs_readdir(struct file *file, struct dir_context *ctx) | |||
| 429 | unsigned long n = pos >> PAGE_SHIFT; | 429 | unsigned long n = pos >> PAGE_SHIFT; |
| 430 | unsigned long npages = dir_pages(inode); | 430 | unsigned long npages = dir_pages(inode); |
| 431 | unsigned chunk_mask = ~(UFS_SB(sb)->s_uspi->s_dirblksize - 1); | 431 | unsigned chunk_mask = ~(UFS_SB(sb)->s_uspi->s_dirblksize - 1); |
| 432 | bool need_revalidate = inode_cmp_iversion(inode, file->f_version); | 432 | bool need_revalidate = !inode_eq_iversion(inode, file->f_version); |
| 433 | unsigned flags = UFS_SB(sb)->s_flags; | 433 | unsigned flags = UFS_SB(sb)->s_flags; |
| 434 | 434 | ||
| 435 | UFSD("BEGIN\n"); | 435 | UFSD("BEGIN\n"); |
diff --git a/include/linux/iversion.h b/include/linux/iversion.h index 3d2fd06495ec..be50ef7cedab 100644 --- a/include/linux/iversion.h +++ b/include/linux/iversion.h | |||
| @@ -45,7 +45,7 @@ | |||
| 45 | * | 45 | * |
| 46 | * With this implementation, the value should always appear to observers to | 46 | * With this implementation, the value should always appear to observers to |
| 47 | * increase over time if the file has changed. It's recommended to use | 47 | * increase over time if the file has changed. It's recommended to use |
| 48 | * inode_cmp_iversion() helper to compare values. | 48 | * inode_eq_iversion() helper to compare values. |
| 49 | * | 49 | * |
| 50 | * Note that some filesystems (e.g. NFS and AFS) just use the field to store | 50 | * Note that some filesystems (e.g. NFS and AFS) just use the field to store |
| 51 | * a server-provided value (for the most part). For that reason, those | 51 | * a server-provided value (for the most part). For that reason, those |
| @@ -305,33 +305,33 @@ inode_query_iversion(struct inode *inode) | |||
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | /** | 307 | /** |
| 308 | * inode_cmp_iversion_raw - check whether the raw i_version counter has changed | 308 | * inode_eq_iversion_raw - check whether the raw i_version counter has changed |
| 309 | * @inode: inode to check | 309 | * @inode: inode to check |
| 310 | * @old: old value to check against its i_version | 310 | * @old: old value to check against its i_version |
| 311 | * | 311 | * |
| 312 | * Compare the current raw i_version counter with a previous one. Returns false | 312 | * Compare the current raw i_version counter with a previous one. Returns true |
| 313 | * if they are the same or true if they are different. | 313 | * if they are the same or false if they are different. |
| 314 | */ | 314 | */ |
| 315 | static inline bool | 315 | static inline bool |
| 316 | inode_cmp_iversion_raw(const struct inode *inode, u64 old) | 316 | inode_eq_iversion_raw(const struct inode *inode, u64 old) |
| 317 | { | 317 | { |
| 318 | return inode_peek_iversion_raw(inode) != old; | 318 | return inode_peek_iversion_raw(inode) == old; |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | /** | 321 | /** |
| 322 | * inode_cmp_iversion - check whether the i_version counter has changed | 322 | * inode_eq_iversion - check whether the i_version counter has changed |
| 323 | * @inode: inode to check | 323 | * @inode: inode to check |
| 324 | * @old: old value to check against its i_version | 324 | * @old: old value to check against its i_version |
| 325 | * | 325 | * |
| 326 | * Compare an i_version counter with a previous one. Returns false if they are | 326 | * Compare an i_version counter with a previous one. Returns true if they are |
| 327 | * the same, and true if they are different. | 327 | * the same, and false if they are different. |
| 328 | * | 328 | * |
| 329 | * Note that we don't need to set the QUERIED flag in this case, as the value | 329 | * Note that we don't need to set the QUERIED flag in this case, as the value |
| 330 | * in the inode is not being recorded for later use. | 330 | * in the inode is not being recorded for later use. |
| 331 | */ | 331 | */ |
| 332 | static inline bool | 332 | static inline bool |
| 333 | inode_cmp_iversion(const struct inode *inode, u64 old) | 333 | inode_eq_iversion(const struct inode *inode, u64 old) |
| 334 | { | 334 | { |
| 335 | return inode_peek_iversion(inode) != old; | 335 | return inode_peek_iversion(inode) == old; |
| 336 | } | 336 | } |
| 337 | #endif | 337 | #endif |
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index 061425dd6400..2cfb0c714967 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c | |||
| @@ -135,7 +135,7 @@ static void ima_check_last_writer(struct integrity_iint_cache *iint, | |||
| 135 | update = test_and_clear_bit(IMA_UPDATE_XATTR, | 135 | update = test_and_clear_bit(IMA_UPDATE_XATTR, |
| 136 | &iint->atomic_flags); | 136 | &iint->atomic_flags); |
| 137 | if (!IS_I_VERSION(inode) || | 137 | if (!IS_I_VERSION(inode) || |
| 138 | inode_cmp_iversion(inode, iint->version) || | 138 | !inode_eq_iversion(inode, iint->version) || |
| 139 | (iint->flags & IMA_NEW_FILE)) { | 139 | (iint->flags & IMA_NEW_FILE)) { |
| 140 | iint->flags &= ~(IMA_DONE_MASK | IMA_NEW_FILE); | 140 | iint->flags &= ~(IMA_DONE_MASK | IMA_NEW_FILE); |
| 141 | iint->measured_pcrs = 0; | 141 | iint->measured_pcrs = 0; |
