aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/dir.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/dir.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/dir.c')
-rw-r--r--fs/gfs2/dir.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index fcb59b23f1e3..f75c9aef9f94 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -135,7 +135,7 @@ static int gfs2_dir_write_stuffed(struct gfs2_inode *ip, const char *buf,
135 memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size); 135 memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size);
136 if (ip->i_inode.i_size < offset + size) 136 if (ip->i_inode.i_size < offset + size)
137 i_size_write(&ip->i_inode, offset + size); 137 i_size_write(&ip->i_inode, offset + size);
138 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 138 ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
139 gfs2_dinode_out(ip, dibh->b_data); 139 gfs2_dinode_out(ip, dibh->b_data);
140 140
141 brelse(dibh); 141 brelse(dibh);
@@ -233,7 +233,7 @@ out:
233 233
234 if (ip->i_inode.i_size < offset + copied) 234 if (ip->i_inode.i_size < offset + copied)
235 i_size_write(&ip->i_inode, offset + copied); 235 i_size_write(&ip->i_inode, offset + copied);
236 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 236 ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
237 237
238 gfs2_trans_add_meta(ip->i_gl, dibh); 238 gfs2_trans_add_meta(ip->i_gl, dibh);
239 gfs2_dinode_out(ip, dibh->b_data); 239 gfs2_dinode_out(ip, dibh->b_data);
@@ -872,7 +872,7 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh,
872 struct gfs2_leaf *leaf; 872 struct gfs2_leaf *leaf;
873 struct gfs2_dirent *dent; 873 struct gfs2_dirent *dent;
874 struct qstr name = { .name = "" }; 874 struct qstr name = { .name = "" };
875 struct timespec tv = CURRENT_TIME; 875 struct timespec tv = current_time(inode);
876 876
877 error = gfs2_alloc_blocks(ip, &bn, &n, 0, NULL); 877 error = gfs2_alloc_blocks(ip, &bn, &n, 0, NULL);
878 if (error) 878 if (error)
@@ -1816,7 +1816,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
1816 gfs2_inum_out(nip, dent); 1816 gfs2_inum_out(nip, dent);
1817 dent->de_type = cpu_to_be16(IF2DT(nip->i_inode.i_mode)); 1817 dent->de_type = cpu_to_be16(IF2DT(nip->i_inode.i_mode));
1818 dent->de_rahead = cpu_to_be16(gfs2_inode_ra_len(nip)); 1818 dent->de_rahead = cpu_to_be16(gfs2_inode_ra_len(nip));
1819 tv = CURRENT_TIME; 1819 tv = current_time(&ip->i_inode);
1820 if (ip->i_diskflags & GFS2_DIF_EXHASH) { 1820 if (ip->i_diskflags & GFS2_DIF_EXHASH) {
1821 leaf = (struct gfs2_leaf *)bh->b_data; 1821 leaf = (struct gfs2_leaf *)bh->b_data;
1822 be16_add_cpu(&leaf->lf_entries, 1); 1822 be16_add_cpu(&leaf->lf_entries, 1);
@@ -1878,7 +1878,7 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct dentry *dentry)
1878 const struct qstr *name = &dentry->d_name; 1878 const struct qstr *name = &dentry->d_name;
1879 struct gfs2_dirent *dent, *prev = NULL; 1879 struct gfs2_dirent *dent, *prev = NULL;
1880 struct buffer_head *bh; 1880 struct buffer_head *bh;
1881 struct timespec tv = CURRENT_TIME; 1881 struct timespec tv = current_time(&dip->i_inode);
1882 1882
1883 /* Returns _either_ the entry (if its first in block) or the 1883 /* Returns _either_ the entry (if its first in block) or the
1884 previous entry otherwise */ 1884 previous entry otherwise */
@@ -1960,7 +1960,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
1960 gfs2_trans_add_meta(dip->i_gl, bh); 1960 gfs2_trans_add_meta(dip->i_gl, bh);
1961 } 1961 }
1962 1962
1963 dip->i_inode.i_mtime = dip->i_inode.i_ctime = CURRENT_TIME; 1963 dip->i_inode.i_mtime = dip->i_inode.i_ctime = current_time(&dip->i_inode);
1964 gfs2_dinode_out(dip, bh->b_data); 1964 gfs2_dinode_out(dip, bh->b_data);
1965 brelse(bh); 1965 brelse(bh);
1966 return 0; 1966 return 0;