From: Deepa Dinamani <deepa.kernel@gmail.com>
To: linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org
Cc: Arnd Bergmann <arnd@arndb.de>, Dave Chinner <david@fromorbit.com>,
"Theodore Ts'o" <tytso@mit.edu>,
linux-kernel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH 02/10] vfs: Replace CURRENT_TIME by current_fs_time()
Date: Tue, 2 Feb 2016 22:07:42 -0800 [thread overview]
Message-ID: <1454479670-8204-3-git-send-email-deepa.kernel@gmail.com> (raw)
In-Reply-To: <1454479670-8204-1-git-send-email-deepa.kernel@gmail.com>
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@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.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
next prev parent reply other threads:[~2016-02-03 6:11 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-03 6:07 [PATCH 00/10] Remove CURRENT_TIME and CURRENT_TIME_SEC - PART 1 Deepa Dinamani
2016-02-03 6:07 ` [PATCH 01/10] fs: Add current_fs_time_sec() function Deepa Dinamani
2016-02-03 6:07 ` Deepa Dinamani [this message]
2016-02-03 6:07 ` [PATCH 03/10] fs: cifs: Replace CURRENT_TIME with current_fs_time() Deepa Dinamani
2016-02-03 6:07 ` [PATCH 04/10] fs: cifs: Replace CURRENT_TIME with ktime_get_real_ts() Deepa Dinamani
2016-02-03 6:07 ` [PATCH 05/10] fs: cifs: Replace CURRENT_TIME by get_seconds Deepa Dinamani
2016-02-03 6:07 ` [PATCH 06/10] fs: ext4: Replace CURRENT_TIME_SEC with current_fs_time_sec() Deepa Dinamani
2016-02-03 6:07 ` [PATCH 07/10] fs: ext4: Replace CURRENT_TIME with ext4_current_time() Deepa Dinamani
2016-02-03 6:07 ` [PATCH 08/10] fs: ceph: replace CURRENT_TIME by current_fs_time() Deepa Dinamani
2016-02-03 6:22 ` Yan, Zheng
2016-02-03 6:07 ` [PATCH 09/10] fs: ceph: Replace CURRENT_TIME by ktime_get_real_ts() Deepa Dinamani
2016-02-03 14:34 ` Yan, Zheng
2016-02-03 16:17 ` Deepa Dinamani
2016-02-03 21:27 ` Arnd Bergmann
2016-02-04 2:00 ` Yan, Zheng
2016-02-04 8:30 ` Arnd Bergmann
2016-02-04 9:01 ` Ilya Dryomov
2016-02-04 13:31 ` Arnd Bergmann
2016-02-04 15:26 ` Gregory Farnum
2016-02-04 21:02 ` [Y2038] " Arnd Bergmann
2016-02-03 6:07 ` [PATCH 10/10] fs: btrfs: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani
2016-02-04 14:14 ` David Sterba
2016-02-05 11:39 ` Deepa Dinamani
2016-02-07 7:57 ` [PATCH v2 " Deepa Dinamani
2016-02-08 15:08 ` David Sterba
2016-02-03 21:30 ` [Y2038] [PATCH 00/10] Remove CURRENT_TIME and CURRENT_TIME_SEC - PART 1 Arnd Bergmann
2016-02-04 4:56 ` Deepa Dinamani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1454479670-8204-3-git-send-email-deepa.kernel@gmail.com \
--to=deepa.kernel@gmail.com \
--cc=arnd@arndb.de \
--cc=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
--cc=y2038@lists.linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).