aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/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/gfs2/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/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index e4da0ecd3285..a197a219eed9 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -652,7 +652,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
652 set_nlink(inode, S_ISDIR(mode) ? 2 : 1); 652 set_nlink(inode, S_ISDIR(mode) ? 2 : 1);
653 inode->i_rdev = dev; 653 inode->i_rdev = dev;
654 inode->i_size = size; 654 inode->i_size = size;
655 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 655 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
656 gfs2_set_inode_blocks(inode, 1); 656 gfs2_set_inode_blocks(inode, 1);
657 munge_mode_uid_gid(dip, inode); 657 munge_mode_uid_gid(dip, inode);
658 check_and_update_goal(dip); 658 check_and_update_goal(dip);
@@ -979,7 +979,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
979 979
980 gfs2_trans_add_meta(ip->i_gl, dibh); 980 gfs2_trans_add_meta(ip->i_gl, dibh);
981 inc_nlink(&ip->i_inode); 981 inc_nlink(&ip->i_inode);
982 ip->i_inode.i_ctime = CURRENT_TIME; 982 ip->i_inode.i_ctime = current_time(&ip->i_inode);
983 ihold(inode); 983 ihold(inode);
984 d_instantiate(dentry, inode); 984 d_instantiate(dentry, inode);
985 mark_inode_dirty(inode); 985 mark_inode_dirty(inode);
@@ -1063,7 +1063,7 @@ static int gfs2_unlink_inode(struct gfs2_inode *dip,
1063 return error; 1063 return error;
1064 1064
1065 ip->i_entries = 0; 1065 ip->i_entries = 0;
1066 inode->i_ctime = CURRENT_TIME; 1066 inode->i_ctime = current_time(inode);
1067 if (S_ISDIR(inode->i_mode)) 1067 if (S_ISDIR(inode->i_mode))
1068 clear_nlink(inode); 1068 clear_nlink(inode);
1069 else 1069 else
@@ -1326,7 +1326,7 @@ static int update_moved_ino(struct gfs2_inode *ip, struct gfs2_inode *ndip,
1326 error = gfs2_meta_inode_buffer(ip, &dibh); 1326 error = gfs2_meta_inode_buffer(ip, &dibh);
1327 if (error) 1327 if (error)
1328 return error; 1328 return error;
1329 ip->i_inode.i_ctime = CURRENT_TIME; 1329 ip->i_inode.i_ctime = current_time(&ip->i_inode);
1330 gfs2_trans_add_meta(ip->i_gl, dibh); 1330 gfs2_trans_add_meta(ip->i_gl, dibh);
1331 gfs2_dinode_out(ip, dibh->b_data); 1331 gfs2_dinode_out(ip, dibh->b_data);
1332 brelse(dibh); 1332 brelse(dibh);