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>
This commit is contained in:
@@ -2005,7 +2005,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
|
||||
if (S_ISLNK(inode->i_mode))
|
||||
inode->i_flags &= ~(S_IMMUTABLE | S_APPEND);
|
||||
|
||||
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
|
||||
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
|
||||
inode->i_size = i_size;
|
||||
inode->i_blocks = 0;
|
||||
inode->i_bytes = 0;
|
||||
|
@@ -94,7 +94,7 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
}
|
||||
sd_attrs_to_i_attrs(flags, inode);
|
||||
REISERFS_I(inode)->i_attrs = flags;
|
||||
inode->i_ctime = CURRENT_TIME_SEC;
|
||||
inode->i_ctime = current_time(inode);
|
||||
mark_inode_dirty(inode);
|
||||
setflags_out:
|
||||
mnt_drop_write_file(filp);
|
||||
@@ -115,7 +115,7 @@ setflags_out:
|
||||
err = -EFAULT;
|
||||
goto setversion_out;
|
||||
}
|
||||
inode->i_ctime = CURRENT_TIME_SEC;
|
||||
inode->i_ctime = current_time(inode);
|
||||
mark_inode_dirty(inode);
|
||||
setversion_out:
|
||||
mnt_drop_write_file(filp);
|
||||
|
@@ -570,7 +570,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
|
||||
}
|
||||
|
||||
dir->i_size += paste_size;
|
||||
dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
|
||||
dir->i_mtime = dir->i_ctime = current_time(dir);
|
||||
if (!S_ISDIR(inode->i_mode) && visible)
|
||||
/* reiserfs_mkdir or reiserfs_rename will do that by itself */
|
||||
reiserfs_update_sd(th, dir);
|
||||
@@ -963,7 +963,7 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||
inode->i_nlink);
|
||||
|
||||
clear_nlink(inode);
|
||||
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
|
||||
inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(dir);
|
||||
reiserfs_update_sd(&th, inode);
|
||||
|
||||
DEC_DIR_INODE_NLINK(dir)
|
||||
@@ -1067,11 +1067,11 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
|
||||
inc_nlink(inode);
|
||||
goto end_unlink;
|
||||
}
|
||||
inode->i_ctime = CURRENT_TIME_SEC;
|
||||
inode->i_ctime = current_time(inode);
|
||||
reiserfs_update_sd(&th, inode);
|
||||
|
||||
dir->i_size -= (de.de_entrylen + DEH_SIZE);
|
||||
dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
|
||||
dir->i_ctime = dir->i_mtime = current_time(dir);
|
||||
reiserfs_update_sd(&th, dir);
|
||||
|
||||
if (!savelink)
|
||||
@@ -1246,7 +1246,7 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir,
|
||||
return err ? err : retval;
|
||||
}
|
||||
|
||||
inode->i_ctime = CURRENT_TIME_SEC;
|
||||
inode->i_ctime = current_time(inode);
|
||||
reiserfs_update_sd(&th, inode);
|
||||
|
||||
ihold(inode);
|
||||
@@ -1567,7 +1567,7 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
|
||||
mark_de_hidden(old_de.de_deh + old_de.de_entry_num);
|
||||
journal_mark_dirty(&th, old_de.de_bh);
|
||||
ctime = CURRENT_TIME_SEC;
|
||||
ctime = current_time(old_dir);
|
||||
old_dir->i_ctime = old_dir->i_mtime = ctime;
|
||||
new_dir->i_ctime = new_dir->i_mtime = ctime;
|
||||
/*
|
||||
|
@@ -1987,8 +1987,8 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
|
||||
pathrelse(&s_search_path);
|
||||
|
||||
if (update_timestamps) {
|
||||
inode->i_mtime = CURRENT_TIME_SEC;
|
||||
inode->i_ctime = CURRENT_TIME_SEC;
|
||||
inode->i_mtime = current_time(inode);
|
||||
inode->i_ctime = current_time(inode);
|
||||
}
|
||||
reiserfs_update_sd(th, inode);
|
||||
|
||||
@@ -2012,8 +2012,8 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
|
||||
update_and_out:
|
||||
if (update_timestamps) {
|
||||
/* this is truncate, not file closing */
|
||||
inode->i_mtime = CURRENT_TIME_SEC;
|
||||
inode->i_ctime = CURRENT_TIME_SEC;
|
||||
inode->i_mtime = current_time(inode);
|
||||
inode->i_ctime = current_time(inode);
|
||||
}
|
||||
reiserfs_update_sd(th, inode);
|
||||
|
||||
|
@@ -2512,7 +2512,7 @@ out:
|
||||
if (inode->i_size < off + len - towrite)
|
||||
i_size_write(inode, off + len - towrite);
|
||||
inode->i_version++;
|
||||
inode->i_mtime = inode->i_ctime = CURRENT_TIME;
|
||||
inode->i_mtime = inode->i_ctime = current_time(inode);
|
||||
mark_inode_dirty(inode);
|
||||
return len - towrite;
|
||||
}
|
||||
|
@@ -450,13 +450,13 @@ int reiserfs_commit_write(struct file *f, struct page *page,
|
||||
|
||||
static void update_ctime(struct inode *inode)
|
||||
{
|
||||
struct timespec now = current_fs_time(inode->i_sb);
|
||||
struct timespec now = current_time(inode);
|
||||
|
||||
if (inode_unhashed(inode) || !inode->i_nlink ||
|
||||
timespec_equal(&inode->i_ctime, &now))
|
||||
return;
|
||||
|
||||
inode->i_ctime = CURRENT_TIME_SEC;
|
||||
inode->i_ctime = current_time(inode);
|
||||
mark_inode_dirty(inode);
|
||||
}
|
||||
|
||||
@@ -575,7 +575,7 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th,
|
||||
new_size = buffer_size + sizeof(struct reiserfs_xattr_header);
|
||||
if (!err && new_size < i_size_read(d_inode(dentry))) {
|
||||
struct iattr newattrs = {
|
||||
.ia_ctime = current_fs_time(inode->i_sb),
|
||||
.ia_ctime = current_time(inode),
|
||||
.ia_size = new_size,
|
||||
.ia_valid = ATTR_SIZE | ATTR_CTIME,
|
||||
};
|
||||
|
@@ -277,7 +277,7 @@ __reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode,
|
||||
if (error == -ENODATA) {
|
||||
error = 0;
|
||||
if (type == ACL_TYPE_ACCESS) {
|
||||
inode->i_ctime = CURRENT_TIME_SEC;
|
||||
inode->i_ctime = current_time(inode);
|
||||
mark_inode_dirty(inode);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user