aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hugetlbfs/inode.c
diff options
context:
space:
mode:
authorDeepa Dinamani <deepa.kernel@gmail.com>2016-09-14 10:48:04 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-09-27 21:06:21 -0400
commit078cd8279e659989b103359bb22373cc79445bde (patch)
tree923e3fe84d232cc9ba31481852ea1faf46f56fb6 /fs/hugetlbfs/inode.c
parent2554c72edb81c97ae5307613dd0aee1ef8dd13ca (diff)
fs: Replace CURRENT_TIME with current_time() for inode timestamps
CURRENT_TIME macro is not appropriate for filesystems as it doesn't use the right granularity for filesystem timestamps. Use current_time() instead. CURRENT_TIME is also not y2038 safe. This is also in preparation for the patch that transitions vfs timestamps to use 64 bit time and hence make them y2038 safe. As part of the effort current_time() will be extended to do range checks. Hence, it is necessary for all file system timestamps to use current_time(). Also, current_time() will be transitioned along with vfs to be y2038 safe. Note that whenever a single call to current_time() is used to change timestamps in different inodes, it is because they share the same time granularity. Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Felipe Balbi <balbi@kernel.org> Acked-by: Steven Whitehouse <swhiteho@redhat.com> Acked-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> Acked-by: David Sterba <dsterba@suse.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/hugetlbfs/inode.c')
-rw-r--r--fs/hugetlbfs/inode.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 4ea71eba40a5..3053e200ec95 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -657,7 +657,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
657 657
658 if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > inode->i_size) 658 if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > inode->i_size)
659 i_size_write(inode, offset + len); 659 i_size_write(inode, offset + len);
660 inode->i_ctime = CURRENT_TIME; 660 inode->i_ctime = current_time(inode);
661out: 661out:
662 inode_unlock(inode); 662 inode_unlock(inode);
663 return error; 663 return error;
@@ -702,7 +702,7 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb,
702 inode->i_mode = S_IFDIR | config->mode; 702 inode->i_mode = S_IFDIR | config->mode;
703 inode->i_uid = config->uid; 703 inode->i_uid = config->uid;
704 inode->i_gid = config->gid; 704 inode->i_gid = config->gid;
705 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 705 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
706 info = HUGETLBFS_I(inode); 706 info = HUGETLBFS_I(inode);
707 mpol_shared_policy_init(&info->policy, NULL); 707 mpol_shared_policy_init(&info->policy, NULL);
708 inode->i_op = &hugetlbfs_dir_inode_operations; 708 inode->i_op = &hugetlbfs_dir_inode_operations;
@@ -741,7 +741,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb,
741 lockdep_set_class(&inode->i_mapping->i_mmap_rwsem, 741 lockdep_set_class(&inode->i_mapping->i_mmap_rwsem,
742 &hugetlbfs_i_mmap_rwsem_key); 742 &hugetlbfs_i_mmap_rwsem_key);
743 inode->i_mapping->a_ops = &hugetlbfs_aops; 743 inode->i_mapping->a_ops = &hugetlbfs_aops;
744 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 744 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
745 inode->i_mapping->private_data = resv_map; 745 inode->i_mapping->private_data = resv_map;
746 info = HUGETLBFS_I(inode); 746 info = HUGETLBFS_I(inode);
747 /* 747 /*
@@ -790,7 +790,7 @@ static int hugetlbfs_mknod(struct inode *dir,
790 790
791 inode = hugetlbfs_get_inode(dir->i_sb, dir, mode, dev); 791 inode = hugetlbfs_get_inode(dir->i_sb, dir, mode, dev);
792 if (inode) { 792 if (inode) {
793 dir->i_ctime = dir->i_mtime = CURRENT_TIME; 793 dir->i_ctime = dir->i_mtime = current_time(dir);
794 d_instantiate(dentry, inode); 794 d_instantiate(dentry, inode);
795 dget(dentry); /* Extra count - pin the dentry in core */ 795 dget(dentry); /* Extra count - pin the dentry in core */
796 error = 0; 796 error = 0;
@@ -827,7 +827,7 @@ static int hugetlbfs_symlink(struct inode *dir,
827 } else 827 } else
828 iput(inode); 828 iput(inode);
829 } 829 }
830 dir->i_ctime = dir->i_mtime = CURRENT_TIME; 830 dir->i_ctime = dir->i_mtime = current_time(dir);
831 831
832 return error; 832 return error;
833} 833}