aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs
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/jfs
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/jfs')
-rw-r--r--fs/jfs/acl.c2
-rw-r--r--fs/jfs/inode.c2
-rw-r--r--fs/jfs/jfs_inode.c2
-rw-r--r--fs/jfs/namei.c22
-rw-r--r--fs/jfs/super.c2
-rw-r--r--fs/jfs/xattr.c2
6 files changed, 16 insertions, 16 deletions
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c
index 21fa92ba2c19..4c1a6b5670df 100644
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -81,7 +81,7 @@ static int __jfs_set_acl(tid_t tid, struct inode *inode, int type,
81 rc = posix_acl_equiv_mode(acl, &inode->i_mode); 81 rc = posix_acl_equiv_mode(acl, &inode->i_mode);
82 if (rc < 0) 82 if (rc < 0)
83 return rc; 83 return rc;
84 inode->i_ctime = CURRENT_TIME; 84 inode->i_ctime = current_time(inode);
85 mark_inode_dirty(inode); 85 mark_inode_dirty(inode);
86 if (rc == 0) 86 if (rc == 0)
87 acl = NULL; 87 acl = NULL;
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index ad3e7b1effc4..054cc761b426 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -403,7 +403,7 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length)
403 break; 403 break;
404 } 404 }
405 405
406 ip->i_mtime = ip->i_ctime = CURRENT_TIME; 406 ip->i_mtime = ip->i_ctime = current_time(ip);
407 mark_inode_dirty(ip); 407 mark_inode_dirty(ip);
408 408
409 txCommit(tid, 1, &ip, 0); 409 txCommit(tid, 1, &ip, 0);
diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c
index 5e33cb9a190d..375dd257a34f 100644
--- a/fs/jfs/jfs_inode.c
+++ b/fs/jfs/jfs_inode.c
@@ -131,7 +131,7 @@ struct inode *ialloc(struct inode *parent, umode_t mode)
131 jfs_inode->mode2 |= inode->i_mode; 131 jfs_inode->mode2 |= inode->i_mode;
132 132
133 inode->i_blocks = 0; 133 inode->i_blocks = 0;
134 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 134 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
135 jfs_inode->otime = inode->i_ctime.tv_sec; 135 jfs_inode->otime = inode->i_ctime.tv_sec;
136 inode->i_generation = JFS_SBI(sb)->gengen++; 136 inode->i_generation = JFS_SBI(sb)->gengen++;
137 137
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 814b0c58016c..b05d0b4c68f6 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -162,7 +162,7 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode,
162 162
163 mark_inode_dirty(ip); 163 mark_inode_dirty(ip);
164 164
165 dip->i_ctime = dip->i_mtime = CURRENT_TIME; 165 dip->i_ctime = dip->i_mtime = current_time(dip);
166 166
167 mark_inode_dirty(dip); 167 mark_inode_dirty(dip);
168 168
@@ -298,7 +298,7 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)
298 298
299 /* update parent directory inode */ 299 /* update parent directory inode */
300 inc_nlink(dip); /* for '..' from child directory */ 300 inc_nlink(dip); /* for '..' from child directory */
301 dip->i_ctime = dip->i_mtime = CURRENT_TIME; 301 dip->i_ctime = dip->i_mtime = current_time(dip);
302 mark_inode_dirty(dip); 302 mark_inode_dirty(dip);
303 303
304 rc = txCommit(tid, 2, &iplist[0], 0); 304 rc = txCommit(tid, 2, &iplist[0], 0);
@@ -406,7 +406,7 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry)
406 /* update parent directory's link count corresponding 406 /* update parent directory's link count corresponding
407 * to ".." entry of the target directory deleted 407 * to ".." entry of the target directory deleted
408 */ 408 */
409 dip->i_ctime = dip->i_mtime = CURRENT_TIME; 409 dip->i_ctime = dip->i_mtime = current_time(dip);
410 inode_dec_link_count(dip); 410 inode_dec_link_count(dip);
411 411
412 /* 412 /*
@@ -528,7 +528,7 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)
528 528
529 ASSERT(ip->i_nlink); 529 ASSERT(ip->i_nlink);
530 530
531 ip->i_ctime = dip->i_ctime = dip->i_mtime = CURRENT_TIME; 531 ip->i_ctime = dip->i_ctime = dip->i_mtime = current_time(ip);
532 mark_inode_dirty(dip); 532 mark_inode_dirty(dip);
533 533
534 /* update target's inode */ 534 /* update target's inode */
@@ -838,8 +838,8 @@ static int jfs_link(struct dentry *old_dentry,
838 838
839 /* update object inode */ 839 /* update object inode */
840 inc_nlink(ip); /* for new link */ 840 inc_nlink(ip); /* for new link */
841 ip->i_ctime = CURRENT_TIME; 841 ip->i_ctime = current_time(ip);
842 dir->i_ctime = dir->i_mtime = CURRENT_TIME; 842 dir->i_ctime = dir->i_mtime = current_time(dir);
843 mark_inode_dirty(dir); 843 mark_inode_dirty(dir);
844 ihold(ip); 844 ihold(ip);
845 845
@@ -1039,7 +1039,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
1039 1039
1040 mark_inode_dirty(ip); 1040 mark_inode_dirty(ip);
1041 1041
1042 dip->i_ctime = dip->i_mtime = CURRENT_TIME; 1042 dip->i_ctime = dip->i_mtime = current_time(dip);
1043 mark_inode_dirty(dip); 1043 mark_inode_dirty(dip);
1044 /* 1044 /*
1045 * commit update of parent directory and link object 1045 * commit update of parent directory and link object
@@ -1215,7 +1215,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1215 tblk->xflag |= COMMIT_DELETE; 1215 tblk->xflag |= COMMIT_DELETE;
1216 tblk->u.ip = new_ip; 1216 tblk->u.ip = new_ip;
1217 } else { 1217 } else {
1218 new_ip->i_ctime = CURRENT_TIME; 1218 new_ip->i_ctime = current_time(new_ip);
1219 mark_inode_dirty(new_ip); 1219 mark_inode_dirty(new_ip);
1220 } 1220 }
1221 } else { 1221 } else {
@@ -1278,7 +1278,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1278 /* 1278 /*
1279 * Update ctime on changed/moved inodes & mark dirty 1279 * Update ctime on changed/moved inodes & mark dirty
1280 */ 1280 */
1281 old_ip->i_ctime = CURRENT_TIME; 1281 old_ip->i_ctime = current_time(old_ip);
1282 mark_inode_dirty(old_ip); 1282 mark_inode_dirty(old_ip);
1283 1283
1284 new_dir->i_ctime = new_dir->i_mtime = current_fs_time(new_dir->i_sb); 1284 new_dir->i_ctime = new_dir->i_mtime = current_fs_time(new_dir->i_sb);
@@ -1293,7 +1293,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1293 1293
1294 if (old_dir != new_dir) { 1294 if (old_dir != new_dir) {
1295 iplist[ipcount++] = new_dir; 1295 iplist[ipcount++] = new_dir;
1296 old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME; 1296 old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir);
1297 mark_inode_dirty(old_dir); 1297 mark_inode_dirty(old_dir);
1298 } 1298 }
1299 1299
@@ -1426,7 +1426,7 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
1426 1426
1427 mark_inode_dirty(ip); 1427 mark_inode_dirty(ip);
1428 1428
1429 dir->i_ctime = dir->i_mtime = CURRENT_TIME; 1429 dir->i_ctime = dir->i_mtime = current_time(dir);
1430 1430
1431 mark_inode_dirty(dir); 1431 mark_inode_dirty(dir);
1432 1432
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index cec8814a3b8b..85671f7f8518 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -830,7 +830,7 @@ out:
830 if (inode->i_size < off+len-towrite) 830 if (inode->i_size < off+len-towrite)
831 i_size_write(inode, off+len-towrite); 831 i_size_write(inode, off+len-towrite);
832 inode->i_version++; 832 inode->i_version++;
833 inode->i_mtime = inode->i_ctime = CURRENT_TIME; 833 inode->i_mtime = inode->i_ctime = current_time(inode);
834 mark_inode_dirty(inode); 834 mark_inode_dirty(inode);
835 inode_unlock(inode); 835 inode_unlock(inode);
836 return len - towrite; 836 return len - towrite;
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
index 0bf3c33aedff..c60f3d32ee91 100644
--- a/fs/jfs/xattr.c
+++ b/fs/jfs/xattr.c
@@ -658,7 +658,7 @@ static int ea_put(tid_t tid, struct inode *inode, struct ea_buffer *ea_buf,
658 if (old_blocks) 658 if (old_blocks)
659 dquot_free_block(inode, old_blocks); 659 dquot_free_block(inode, old_blocks);
660 660
661 inode->i_ctime = CURRENT_TIME; 661 inode->i_ctime = current_time(inode);
662 662
663 return 0; 663 return 0;
664} 664}