summaryrefslogtreecommitdiffstats
path: root/fs/ext2
diff options
context:
space:
mode:
authorDeepa Dinamani <deepa.kernel@gmail.com>2016-09-14 10:48:05 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-09-27 21:06:22 -0400
commit02027d42c3f747945f19111d3da2092ed2148ac8 (patch)
tree1eac59f95ba905fb1d1fe5a53a792145e8e9c267 /fs/ext2
parent078cd8279e659989b103359bb22373cc79445bde (diff)
fs: Replace CURRENT_TIME_SEC with current_time() for inode timestamps
CURRENT_TIME_SEC is not y2038 safe. current_time() will be transitioned to use 64 bit time along with vfs in a separate patch. There is no plan to transistion CURRENT_TIME_SEC to use y2038 safe time interfaces. current_time() will also be extended to use superblock range checking parameters when range checking is introduced. This works because alloc_super() fills in the the s_time_gran in super block to NSEC_PER_SEC. Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Acked-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/acl.c2
-rw-r--r--fs/ext2/dir.c6
-rw-r--r--fs/ext2/ialloc.c2
-rw-r--r--fs/ext2/inode.c4
-rw-r--r--fs/ext2/ioctl.c4
-rw-r--r--fs/ext2/namei.c6
-rw-r--r--fs/ext2/xattr.c2
7 files changed, 13 insertions, 13 deletions
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index 42f1d1814083..80c1e579428a 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -194,7 +194,7 @@ ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
194 if (error < 0) 194 if (error < 0)
195 return error; 195 return error;
196 else { 196 else {
197 inode->i_ctime = CURRENT_TIME_SEC; 197 inode->i_ctime = current_time(inode);
198 mark_inode_dirty(inode); 198 mark_inode_dirty(inode);
199 if (error == 0) 199 if (error == 0)
200 acl = NULL; 200 acl = NULL;
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 61ad490ed67b..d9650c9508e4 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -471,7 +471,7 @@ void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
471 err = ext2_commit_chunk(page, pos, len); 471 err = ext2_commit_chunk(page, pos, len);
472 ext2_put_page(page); 472 ext2_put_page(page);
473 if (update_times) 473 if (update_times)
474 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 474 dir->i_mtime = dir->i_ctime = current_time(dir);
475 EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL; 475 EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
476 mark_inode_dirty(dir); 476 mark_inode_dirty(dir);
477} 477}
@@ -561,7 +561,7 @@ got_it:
561 de->inode = cpu_to_le32(inode->i_ino); 561 de->inode = cpu_to_le32(inode->i_ino);
562 ext2_set_de_type (de, inode); 562 ext2_set_de_type (de, inode);
563 err = ext2_commit_chunk(page, pos, rec_len); 563 err = ext2_commit_chunk(page, pos, rec_len);
564 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 564 dir->i_mtime = dir->i_ctime = current_time(dir);
565 EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL; 565 EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
566 mark_inode_dirty(dir); 566 mark_inode_dirty(dir);
567 /* OFFSET_CACHE */ 567 /* OFFSET_CACHE */
@@ -610,7 +610,7 @@ int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page )
610 pde->rec_len = ext2_rec_len_to_disk(to - from); 610 pde->rec_len = ext2_rec_len_to_disk(to - from);
611 dir->inode = 0; 611 dir->inode = 0;
612 err = ext2_commit_chunk(page, pos, to - from); 612 err = ext2_commit_chunk(page, pos, to - from);
613 inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC; 613 inode->i_ctime = inode->i_mtime = current_time(inode);
614 EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL; 614 EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL;
615 mark_inode_dirty(inode); 615 mark_inode_dirty(inode);
616out: 616out:
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index efe5fb21c533..43dc9c54335c 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -551,7 +551,7 @@ got:
551 551
552 inode->i_ino = ino; 552 inode->i_ino = ino;
553 inode->i_blocks = 0; 553 inode->i_blocks = 0;
554 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; 554 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
555 memset(ei->i_data, 0, sizeof(ei->i_data)); 555 memset(ei->i_data, 0, sizeof(ei->i_data));
556 ei->i_flags = 556 ei->i_flags =
557 ext2_mask_flags(mode, EXT2_I(dir)->i_flags & EXT2_FL_INHERITED); 557 ext2_mask_flags(mode, EXT2_I(dir)->i_flags & EXT2_FL_INHERITED);
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index d5c7d09919f3..b66a6585a521 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -594,7 +594,7 @@ static void ext2_splice_branch(struct inode *inode,
594 if (where->bh) 594 if (where->bh)
595 mark_buffer_dirty_inode(where->bh, inode); 595 mark_buffer_dirty_inode(where->bh, inode);
596 596
597 inode->i_ctime = CURRENT_TIME_SEC; 597 inode->i_ctime = current_time(inode);
598 mark_inode_dirty(inode); 598 mark_inode_dirty(inode);
599} 599}
600 600
@@ -1236,7 +1236,7 @@ static int ext2_setsize(struct inode *inode, loff_t newsize)
1236 __ext2_truncate_blocks(inode, newsize); 1236 __ext2_truncate_blocks(inode, newsize);
1237 dax_sem_up_write(EXT2_I(inode)); 1237 dax_sem_up_write(EXT2_I(inode));
1238 1238
1239 inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; 1239 inode->i_mtime = inode->i_ctime = current_time(inode);
1240 if (inode_needs_sync(inode)) { 1240 if (inode_needs_sync(inode)) {
1241 sync_mapping_buffers(inode->i_mapping); 1241 sync_mapping_buffers(inode->i_mapping);
1242 sync_inode_metadata(inode, 1); 1242 sync_inode_metadata(inode, 1);
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c
index b386af2e45f4..9d617423e936 100644
--- a/fs/ext2/ioctl.c
+++ b/fs/ext2/ioctl.c
@@ -79,7 +79,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
79 ei->i_flags = flags; 79 ei->i_flags = flags;
80 80
81 ext2_set_inode_flags(inode); 81 ext2_set_inode_flags(inode);
82 inode->i_ctime = CURRENT_TIME_SEC; 82 inode->i_ctime = current_time(inode);
83 inode_unlock(inode); 83 inode_unlock(inode);
84 84
85 mark_inode_dirty(inode); 85 mark_inode_dirty(inode);
@@ -103,7 +103,7 @@ setflags_out:
103 } 103 }
104 104
105 inode_lock(inode); 105 inode_lock(inode);
106 inode->i_ctime = CURRENT_TIME_SEC; 106 inode->i_ctime = current_time(inode);
107 inode->i_generation = generation; 107 inode->i_generation = generation;
108 inode_unlock(inode); 108 inode_unlock(inode);
109 109
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index d446203127fc..edb7b8c116eb 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -221,7 +221,7 @@ static int ext2_link (struct dentry * old_dentry, struct inode * dir,
221 if (err) 221 if (err)
222 return err; 222 return err;
223 223
224 inode->i_ctime = CURRENT_TIME_SEC; 224 inode->i_ctime = current_time(inode);
225 inode_inc_link_count(inode); 225 inode_inc_link_count(inode);
226 ihold(inode); 226 ihold(inode);
227 227
@@ -372,7 +372,7 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
372 if (!new_de) 372 if (!new_de)
373 goto out_dir; 373 goto out_dir;
374 ext2_set_link(new_dir, new_de, new_page, old_inode, 1); 374 ext2_set_link(new_dir, new_de, new_page, old_inode, 1);
375 new_inode->i_ctime = CURRENT_TIME_SEC; 375 new_inode->i_ctime = current_time(new_inode);
376 if (dir_de) 376 if (dir_de)
377 drop_nlink(new_inode); 377 drop_nlink(new_inode);
378 inode_dec_link_count(new_inode); 378 inode_dec_link_count(new_inode);
@@ -388,7 +388,7 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
388 * Like most other Unix systems, set the ctime for inodes on a 388 * Like most other Unix systems, set the ctime for inodes on a
389 * rename. 389 * rename.
390 */ 390 */
391 old_inode->i_ctime = CURRENT_TIME_SEC; 391 old_inode->i_ctime = current_time(old_inode);
392 mark_inode_dirty(old_inode); 392 mark_inode_dirty(old_inode);
393 393
394 ext2_delete_entry (old_de, old_page); 394 ext2_delete_entry (old_de, old_page);
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index b7f896f3f7a7..fbdb8f171893 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -691,7 +691,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
691 691
692 /* Update the inode. */ 692 /* Update the inode. */
693 EXT2_I(inode)->i_file_acl = new_bh ? new_bh->b_blocknr : 0; 693 EXT2_I(inode)->i_file_acl = new_bh ? new_bh->b_blocknr : 0;
694 inode->i_ctime = CURRENT_TIME_SEC; 694 inode->i_ctime = current_time(inode);
695 if (IS_SYNC(inode)) { 695 if (IS_SYNC(inode)) {
696 error = sync_inode_metadata(inode, 1); 696 error = sync_inode_metadata(inode, 1);
697 /* In case sync failed due to ENOSPC the inode was actually 697 /* In case sync failed due to ENOSPC the inode was actually