Skip to content
This repository was archived by the owner on Feb 9, 2023. It is now read-only.

Commit 02027d4

Browse files
deepa-hubAl Viro
authored andcommitted
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 <[email protected]> Acked-by: Jan Kara <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 078cd82 commit 02027d4

47 files changed

Lines changed: 105 additions & 105 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

fs/affs/amigaffs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ affs_insert_hash(struct inode *dir, struct buffer_head *bh)
5858
mark_buffer_dirty_inode(dir_bh, dir);
5959
affs_brelse(dir_bh);
6060

61-
dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
61+
dir->i_mtime = dir->i_ctime = current_time(dir);
6262
dir->i_version++;
6363
mark_inode_dirty(dir);
6464

@@ -112,7 +112,7 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh)
112112

113113
affs_brelse(bh);
114114

115-
dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
115+
dir->i_mtime = dir->i_ctime = current_time(dir);
116116
dir->i_version++;
117117
mark_inode_dirty(dir);
118118

@@ -313,7 +313,7 @@ affs_remove_header(struct dentry *dentry)
313313
else
314314
clear_nlink(inode);
315315
affs_unlock_link(inode);
316-
inode->i_ctime = CURRENT_TIME_SEC;
316+
inode->i_ctime = current_time(inode);
317317
mark_inode_dirty(inode);
318318

319319
done:

fs/affs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ affs_new_inode(struct inode *dir)
309309
inode->i_gid = current_fsgid();
310310
inode->i_ino = block;
311311
set_nlink(inode, 1);
312-
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
312+
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
313313
atomic_set(&AFFS_I(inode)->i_opencnt, 0);
314314
AFFS_I(inode)->i_blkcnt = 0;
315315
AFFS_I(inode)->i_lc = NULL;

fs/bfs/dir.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
9797
set_bit(ino, info->si_imap);
9898
info->si_freei--;
9999
inode_init_owner(inode, dir, mode);
100-
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
100+
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
101101
inode->i_blocks = 0;
102102
inode->i_op = &bfs_file_inops;
103103
inode->i_fop = &bfs_file_operations;
@@ -165,7 +165,7 @@ static int bfs_link(struct dentry *old, struct inode *dir,
165165
return err;
166166
}
167167
inc_nlink(inode);
168-
inode->i_ctime = CURRENT_TIME_SEC;
168+
inode->i_ctime = current_time(inode);
169169
mark_inode_dirty(inode);
170170
ihold(inode);
171171
d_instantiate(new, inode);
@@ -194,7 +194,7 @@ static int bfs_unlink(struct inode *dir, struct dentry *dentry)
194194
}
195195
de->ino = 0;
196196
mark_buffer_dirty_inode(bh, dir);
197-
dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
197+
dir->i_ctime = dir->i_mtime = current_time(dir);
198198
mark_inode_dirty(dir);
199199
inode->i_ctime = dir->i_ctime;
200200
inode_dec_link_count(inode);
@@ -249,10 +249,10 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry,
249249
goto end_rename;
250250
}
251251
old_de->ino = 0;
252-
old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
252+
old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir);
253253
mark_inode_dirty(old_dir);
254254
if (new_inode) {
255-
new_inode->i_ctime = CURRENT_TIME_SEC;
255+
new_inode->i_ctime = current_time(new_inode);
256256
inode_dec_link_count(new_inode);
257257
}
258258
mark_buffer_dirty_inode(old_bh, old_dir);
@@ -300,9 +300,9 @@ static int bfs_add_entry(struct inode *dir, const unsigned char *name,
300300
pos = (block - sblock) * BFS_BSIZE + off;
301301
if (pos >= dir->i_size) {
302302
dir->i_size += BFS_DIRENT_SIZE;
303-
dir->i_ctime = CURRENT_TIME_SEC;
303+
dir->i_ctime = current_time(dir);
304304
}
305-
dir->i_mtime = CURRENT_TIME_SEC;
305+
dir->i_mtime = current_time(dir);
306306
mark_inode_dirty(dir);
307307
de->ino = cpu_to_le16((u16)ino);
308308
for (i = 0; i < BFS_NAMELEN; i++)

fs/coda/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static inline void coda_dir_update_mtime(struct inode *dir)
109109
/* optimistically we can also act as if our nose bleeds. The
110110
* granularity of the mtime is coarse anyways so we might actually be
111111
* right most of the time. Note: we only do this for directories. */
112-
dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
112+
dir->i_mtime = dir->i_ctime = current_time(dir);
113113
#endif
114114
}
115115

fs/coda/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ coda_file_write_iter(struct kiocb *iocb, struct iov_iter *to)
7575
ret = vfs_iter_write(cfi->cfi_container, to, &iocb->ki_pos);
7676
coda_inode->i_size = file_inode(host_file)->i_size;
7777
coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9;
78-
coda_inode->i_mtime = coda_inode->i_ctime = CURRENT_TIME_SEC;
78+
coda_inode->i_mtime = coda_inode->i_ctime = current_time(coda_inode);
7979
inode_unlock(coda_inode);
8080
file_end_write(host_file);
8181
return ret;

fs/coda/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ int coda_setattr(struct dentry *de, struct iattr *iattr)
271271

272272
memset(&vattr, 0, sizeof(vattr));
273273

274-
inode->i_ctime = CURRENT_TIME_SEC;
274+
inode->i_ctime = current_time(inode);
275275
coda_iattr_to_vattr(iattr, &vattr);
276276
vattr.va_type = C_VNON; /* cannot set type */
277277

fs/ext2/acl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
194194
if (error < 0)
195195
return error;
196196
else {
197-
inode->i_ctime = CURRENT_TIME_SEC;
197+
inode->i_ctime = current_time(inode);
198198
mark_inode_dirty(inode);
199199
if (error == 0)
200200
acl = NULL;

fs/ext2/dir.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
471471
err = ext2_commit_chunk(page, pos, len);
472472
ext2_put_page(page);
473473
if (update_times)
474-
dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
474+
dir->i_mtime = dir->i_ctime = current_time(dir);
475475
EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
476476
mark_inode_dirty(dir);
477477
}
@@ -561,7 +561,7 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode)
561561
de->inode = cpu_to_le32(inode->i_ino);
562562
ext2_set_de_type (de, inode);
563563
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);
565565
EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
566566
mark_inode_dirty(dir);
567567
/* OFFSET_CACHE */
@@ -610,7 +610,7 @@ int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page )
610610
pde->rec_len = ext2_rec_len_to_disk(to - from);
611611
dir->inode = 0;
612612
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);
614614
EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL;
615615
mark_inode_dirty(inode);
616616
out:

fs/ext2/ialloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ struct inode *ext2_new_inode(struct inode *dir, umode_t mode,
551551

552552
inode->i_ino = ino;
553553
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);
555555
memset(ei->i_data, 0, sizeof(ei->i_data));
556556
ei->i_flags =
557557
ext2_mask_flags(mode, EXT2_I(dir)->i_flags & EXT2_FL_INHERITED);

fs/ext2/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ static void ext2_splice_branch(struct inode *inode,
594594
if (where->bh)
595595
mark_buffer_dirty_inode(where->bh, inode);
596596

597-
inode->i_ctime = CURRENT_TIME_SEC;
597+
inode->i_ctime = current_time(inode);
598598
mark_inode_dirty(inode);
599599
}
600600

@@ -1236,7 +1236,7 @@ static int ext2_setsize(struct inode *inode, loff_t newsize)
12361236
__ext2_truncate_blocks(inode, newsize);
12371237
dax_sem_up_write(EXT2_I(inode));
12381238

1239-
inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
1239+
inode->i_mtime = inode->i_ctime = current_time(inode);
12401240
if (inode_needs_sync(inode)) {
12411241
sync_mapping_buffers(inode->i_mapping);
12421242
sync_inode_metadata(inode, 1);

0 commit comments

Comments
 (0)