[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1454479670-8204-3-git-send-email-deepa.kernel@gmail.com>
Date: Tue, 2 Feb 2016 22:07:42 -0800
From: Deepa Dinamani <deepa.kernel@...il.com>
To: linux-fsdevel@...r.kernel.org, y2038@...ts.linaro.org
Cc: Arnd Bergmann <arnd@...db.de>, Dave Chinner <david@...morbit.com>,
"Theodore Ts'o" <tytso@....edu>, linux-kernel@...r.kernel.org,
Alexander Viro <viro@...iv.linux.org.uk>
Subject: [PATCH 02/10] vfs: Replace CURRENT_TIME by current_fs_time()
The CURRENT_TIME macro is not sufficient for filesystem timestamps since
it does not truncate the values according to filesystem granularity.
simple_link(), simple_unlink() and simple_rename() only need a single
call to current_fs_time() since they do not span filesystems.
Signed-off-by: Deepa Dinamani <deepa.kernel@...il.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>
Cc: linux-fsdevel@...r.kernel.org
---
fs/libfs.c | 21 +++++++++++++--------
fs/nsfs.c | 3 ++-
fs/pipe.c | 3 ++-
fs/posix_acl.c | 2 +-
4 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/fs/libfs.c b/fs/libfs.c
index 0ca80b2..e3a8ed5 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -237,7 +237,7 @@ struct dentry *mount_pseudo(struct file_system_type *fs_type, char *name,
*/
root->i_ino = 1;
root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR;
- root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME;
+ root->i_atime = root->i_mtime = root->i_ctime = current_fs_time(s);
dentry = __d_alloc(s, &d_name);
if (!dentry) {
iput(root);
@@ -267,7 +267,8 @@ int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *den
{
struct inode *inode = d_inode(old_dentry);
- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+ inode->i_ctime = dir->i_ctime =
+ dir->i_mtime = current_fs_time(dir->i_sb);
inc_nlink(inode);
ihold(inode);
dget(dentry);
@@ -301,7 +302,8 @@ int simple_unlink(struct inode *dir, struct dentry *dentry)
{
struct inode *inode = d_inode(dentry);
- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+ inode->i_ctime = dir->i_ctime =
+ dir->i_mtime = current_fs_time(dir->i_sb);
drop_nlink(inode);
dput(dentry);
return 0;
@@ -340,8 +342,9 @@ int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
inc_nlink(new_dir);
}
- old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime =
- new_dir->i_mtime = inode->i_ctime = CURRENT_TIME;
+ old_dir->i_ctime = old_dir->i_mtime =
+ new_dir->i_ctime = new_dir->i_mtime =
+ inode->i_ctime = current_fs_time(inode->i_sb);
return 0;
}
@@ -492,7 +495,7 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
*/
inode->i_ino = 1;
inode->i_mode = S_IFDIR | 0755;
- inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ inode->i_atime = inode->i_mtime = inode->i_ctime = current_fs_time(s);
inode->i_op = &simple_dir_inode_operations;
inode->i_fop = &simple_dir_operations;
set_nlink(inode, 2);
@@ -518,7 +521,8 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
goto out;
}
inode->i_mode = S_IFREG | files->mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ inode->i_atime = inode->i_mtime =
+ inode->i_ctime = current_fs_time(s);
inode->i_fop = files->ops;
inode->i_ino = i;
d_add(dentry, inode);
@@ -1064,7 +1068,8 @@ struct inode *alloc_anon_inode(struct super_block *s)
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
inode->i_flags |= S_PRIVATE;
- inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ inode->i_atime = inode->i_mtime =
+ inode->i_ctime = current_fs_time(inode->i_sb);
return inode;
}
EXPORT_SYMBOL(alloc_anon_inode);
diff --git a/fs/nsfs.c b/fs/nsfs.c
index 8f20d60..f0e18b2 100644
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -82,7 +82,8 @@ slow:
return ERR_PTR(-ENOMEM);
}
inode->i_ino = ns->inum;
- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
+ inode->i_mtime = inode->i_atime =
+ inode->i_ctime = current_fs_time(inode->i_sb);
inode->i_flags |= S_IMMUTABLE;
inode->i_mode = S_IFREG | S_IRUGO;
inode->i_fop = &ns_file_operations;
diff --git a/fs/pipe.c b/fs/pipe.c
index c1c1b26..ad3fc8d 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -699,7 +699,8 @@ static struct inode * get_pipe_inode(void)
inode->i_mode = S_IFIFO | S_IRUSR | S_IWUSR;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
- inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ inode->i_atime = inode->i_mtime =
+ inode->i_ctime = current_fs_time(inode->i_sb);
return inode;
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 711dd51..778a27e 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -859,7 +859,7 @@ int simple_set_acl(struct inode *inode, struct posix_acl *acl, int type)
acl = NULL;
}
- inode->i_ctime = CURRENT_TIME;
+ inode->i_ctime = current_fs_time(inode->i_sb);
set_cached_acl(inode, type, acl);
return 0;
}
--
1.9.1
Powered by blists - more mailing lists