linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros
@ 2016-06-09  5:04 Deepa Dinamani
  2016-06-09  5:04 ` [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time() Deepa Dinamani
                   ` (20 more replies)
  0 siblings, 21 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Anna Schumaker, Anton Vorontsov, Benny Halevy, Boaz Harrosh,
	Changman Lee, Chris Mason, Colin Cross, Dave Kleikamp,
	David S. Miller, David Sterba, Eric Van Hensbergen, Felipe Balbi,
	Hugh Dickins, Ian Kent, Jaegeuk Kim, Joern Engel, Josef Bacik,
	Kees Cook, Latchesar Ionkov, Matt Fleming, Matthew Garrett,
	Miklos Szeredi, Nadia Yvette Chambers, Prasad Joshi,
	Robert Richter, Ron Minnich, Tony Luck, Trond Myklebust, autofs,
	cluster-devel, jfs-discussion, linux-btrfs, linux-efi,
	linux-f2fs-devel, linux-mm, linux-nfs, linux-nilfs, linuxppc-dev,
	linux-rdma, linux-s390, linux-security-module, linux-usb, logfs,
	netdev, ocfs2-devel, oprofile-list, osd-dev, selinux,
	v9fs-developer

The series is aimed at getting rid of CURRENT_TIME and CURRENT_TIME_SEC macros.
The macros are not y2038 safe. There is no plan to transition them into being
y2038 safe.
ktime_get_* api's can be used in their place. And, these are y2038 safe.

All filesystem timestamps use current_fs_time() for the right granularity
as mentioned in the respective commit texts of patches.

This series also serves as a preparatory series to transition vfs to 64 bit
timestamps as outlined here: https://lkml.org/lkml/2016/2/12/104 .

As per Linus's suggestion in https://lkml.org/lkml/2016/5/24/663 , all the
inode timestamp changes have been squashed into a single patch. Also,
current_fs_time() now is used as a single generic filesystem timestamp api.
Posting all patches together in a bigger series so that the big picture is
clear.

As per the suggestion in https://lwn.net/Articles/672598/ , CURRENT_TIME
macro bug fixes are being handled in a series separate from transitioning
vfs to use 64 bit timestamps.

Some reviewers have requested not to change line wrapping only for the
longer function call names, so checkpatch warnings for such cases are
ignored in the patch series.

Deepa Dinamani (21):
  fs: Replace CURRENT_TIME_SEC with current_fs_time()
  fs: ext4: Use current_fs_time() for inode timestamps
  fs: ubifs: Use current_fs_time() for inode timestamps
  fs: Replace CURRENT_TIME with current_fs_time() for inode timestamps
  fs: jfs: Replace CURRENT_TIME_SEC by current_fs_time()
  fs: udf: Replace CURRENT_TIME with current_fs_time()
  fs: cifs: Replace CURRENT_TIME by current_fs_time()
  fs: cifs: Replace CURRENT_TIME with ktime_get_real_ts()
  fs: cifs: Replace CURRENT_TIME by get_seconds
  fs: f2fs: Use ktime_get_real_seconds for sit_info times
  drivers: staging: lustre: Replace CURRENT_TIME with current_fs_time()
  block: rbd: Replace non inode CURRENT_TIME with current_fs_time()
  fs: ocfs2: Use time64_t to represent orphan scan times
  fs: ocfs2: Replace CURRENT_TIME with ktime_get_real_seconds()
  time: Add time64_to_tm()
  fnic: Use time64_t to represent trace timestamps
  audit: Use timespec64 to represent audit timestamps
  fs: nfs: Make nfs boot time y2038 safe
  libceph: Remove CURRENT_TIME references
  libceph: Replace CURRENT_TIME with ktime_get_real_ts
  time: Delete CURRENT_TIME_SEC and CURRENT_TIME macro

 arch/powerpc/platforms/cell/spufs/inode.c          |  2 +-
 arch/s390/hypfs/inode.c                            |  4 +--
 drivers/block/rbd.c                                |  2 +-
 drivers/infiniband/hw/qib/qib_fs.c                 |  2 +-
 drivers/misc/ibmasm/ibmasmfs.c                     |  2 +-
 drivers/oprofile/oprofilefs.c                      |  2 +-
 drivers/scsi/fnic/fnic_trace.c                     |  4 +--
 drivers/scsi/fnic/fnic_trace.h                     |  2 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c    | 17 ++++++-----
 drivers/staging/lustre/lustre/llite/namei.c        |  4 +--
 drivers/staging/lustre/lustre/mdc/mdc_reint.c      |  6 ++--
 .../lustre/lustre/obdclass/linux/linux-obdo.c      |  6 ++--
 drivers/staging/lustre/lustre/obdclass/obdo.c      |  6 ++--
 drivers/staging/lustre/lustre/osc/osc_io.c         |  2 +-
 drivers/usb/core/devio.c                           | 19 ++++++------
 drivers/usb/gadget/function/f_fs.c                 |  2 +-
 drivers/usb/gadget/legacy/inode.c                  |  2 +-
 fs/9p/vfs_inode.c                                  |  2 +-
 fs/adfs/inode.c                                    |  2 +-
 fs/affs/amigaffs.c                                 |  6 ++--
 fs/affs/inode.c                                    |  2 +-
 fs/afs/inode.c                                     |  3 +-
 fs/autofs4/inode.c                                 |  2 +-
 fs/autofs4/root.c                                  | 19 +++++++-----
 fs/bfs/dir.c                                       | 18 ++++++-----
 fs/btrfs/inode.c                                   |  2 +-
 fs/cifs/cifsencrypt.c                              |  4 ++-
 fs/cifs/cifssmb.c                                  | 10 +++----
 fs/cifs/inode.c                                    | 15 +++++-----
 fs/coda/dir.c                                      |  2 +-
 fs/coda/file.c                                     |  2 +-
 fs/coda/inode.c                                    |  2 +-
 fs/devpts/inode.c                                  |  6 ++--
 fs/efivarfs/inode.c                                |  2 +-
 fs/exofs/dir.c                                     |  9 +++---
 fs/exofs/inode.c                                   |  7 +++--
 fs/exofs/namei.c                                   |  6 ++--
 fs/ext2/acl.c                                      |  2 +-
 fs/ext2/dir.c                                      |  6 ++--
 fs/ext2/ialloc.c                                   |  2 +-
 fs/ext2/inode.c                                    |  4 +--
 fs/ext2/ioctl.c                                    |  5 ++--
 fs/ext2/namei.c                                    |  6 ++--
 fs/ext2/super.c                                    |  2 +-
 fs/ext2/xattr.c                                    |  2 +-
 fs/ext4/acl.c                                      |  2 +-
 fs/ext4/ext4.h                                     |  6 ----
 fs/ext4/extents.c                                  | 10 +++----
 fs/ext4/ialloc.c                                   |  2 +-
 fs/ext4/inline.c                                   |  4 +--
 fs/ext4/inode.c                                    |  6 ++--
 fs/ext4/ioctl.c                                    |  8 ++---
 fs/ext4/namei.c                                    | 24 ++++++++-------
 fs/ext4/super.c                                    |  2 +-
 fs/ext4/xattr.c                                    |  2 +-
 fs/f2fs/dir.c                                      |  8 ++---
 fs/f2fs/file.c                                     |  8 ++---
 fs/f2fs/inline.c                                   |  2 +-
 fs/f2fs/namei.c                                    | 12 ++++----
 fs/f2fs/segment.c                                  |  2 +-
 fs/f2fs/segment.h                                  |  5 ++--
 fs/f2fs/xattr.c                                    |  2 +-
 fs/fat/dir.c                                       |  2 +-
 fs/fat/file.c                                      |  4 +--
 fs/fat/inode.c                                     |  2 +-
 fs/fat/namei_msdos.c                               | 13 ++++----
 fs/fat/namei_vfat.c                                | 10 +++----
 fs/fuse/control.c                                  |  2 +-
 fs/gfs2/bmap.c                                     |  8 ++---
 fs/gfs2/dir.c                                      | 12 ++++----
 fs/gfs2/inode.c                                    |  8 ++---
 fs/gfs2/quota.c                                    |  2 +-
 fs/gfs2/xattr.c                                    |  8 ++---
 fs/hfs/catalog.c                                   |  8 ++---
 fs/hfs/dir.c                                       |  2 +-
 fs/hfs/inode.c                                     |  2 +-
 fs/hfsplus/catalog.c                               |  8 ++---
 fs/hfsplus/dir.c                                   |  6 ++--
 fs/hfsplus/inode.c                                 |  2 +-
 fs/hfsplus/ioctl.c                                 |  2 +-
 fs/hugetlbfs/inode.c                               | 10 +++----
 fs/jffs2/acl.c                                     |  2 +-
 fs/jffs2/fs.c                                      |  2 +-
 fs/jfs/acl.c                                       |  2 +-
 fs/jfs/inode.c                                     |  5 ++--
 fs/jfs/ioctl.c                                     |  4 +--
 fs/jfs/jfs_inode.c                                 |  2 +-
 fs/jfs/namei.c                                     | 35 ++++++++++++----------
 fs/jfs/super.c                                     |  2 +-
 fs/jfs/xattr.c                                     |  2 +-
 fs/libfs.c                                         | 14 ++++-----
 fs/logfs/dir.c                                     |  6 ++--
 fs/logfs/file.c                                    |  2 +-
 fs/logfs/inode.c                                   |  3 +-
 fs/logfs/readwrite.c                               |  4 +--
 fs/minix/bitmap.c                                  |  2 +-
 fs/minix/dir.c                                     | 12 ++++----
 fs/minix/itree_common.c                            |  4 +--
 fs/minix/namei.c                                   |  4 +--
 fs/nfs/client.c                                    |  2 +-
 fs/nfs/netns.h                                     |  2 +-
 fs/nilfs2/dir.c                                    |  6 ++--
 fs/nilfs2/inode.c                                  |  4 +--
 fs/nilfs2/ioctl.c                                  |  2 +-
 fs/nilfs2/namei.c                                  |  6 ++--
 fs/nsfs.c                                          |  5 ++--
 fs/ocfs2/acl.c                                     |  2 +-
 fs/ocfs2/alloc.c                                   |  2 +-
 fs/ocfs2/aops.c                                    |  2 +-
 fs/ocfs2/cluster/heartbeat.c                       |  2 +-
 fs/ocfs2/dir.c                                     |  4 +--
 fs/ocfs2/dlmfs/dlmfs.c                             |  4 +--
 fs/ocfs2/file.c                                    | 12 ++++----
 fs/ocfs2/inode.c                                   |  2 +-
 fs/ocfs2/journal.c                                 |  4 +--
 fs/ocfs2/move_extents.c                            |  2 +-
 fs/ocfs2/namei.c                                   | 17 ++++++-----
 fs/ocfs2/ocfs2.h                                   |  2 +-
 fs/ocfs2/refcounttree.c                            |  4 +--
 fs/ocfs2/super.c                                   |  2 +-
 fs/ocfs2/xattr.c                                   |  2 +-
 fs/omfs/dir.c                                      |  4 +--
 fs/omfs/inode.c                                    |  2 +-
 fs/openpromfs/inode.c                              |  2 +-
 fs/orangefs/file.c                                 |  2 +-
 fs/orangefs/inode.c                                |  2 +-
 fs/orangefs/namei.c                                |  6 ++--
 fs/pipe.c                                          |  5 ++--
 fs/posix_acl.c                                     |  2 +-
 fs/proc/base.c                                     |  2 +-
 fs/proc/inode.c                                    |  4 +--
 fs/proc/proc_sysctl.c                              |  2 +-
 fs/proc/self.c                                     |  2 +-
 fs/proc/thread_self.c                              |  2 +-
 fs/pstore/inode.c                                  |  2 +-
 fs/ramfs/inode.c                                   | 12 ++++----
 fs/reiserfs/inode.c                                |  2 +-
 fs/reiserfs/ioctl.c                                |  4 +--
 fs/reiserfs/namei.c                                | 14 ++++-----
 fs/reiserfs/stree.c                                |  6 ++--
 fs/reiserfs/super.c                                |  2 +-
 fs/reiserfs/xattr.c                                |  2 +-
 fs/reiserfs/xattr_acl.c                            |  2 +-
 fs/sysv/dir.c                                      |  6 ++--
 fs/sysv/ialloc.c                                   |  2 +-
 fs/sysv/itree.c                                    |  4 +--
 fs/sysv/namei.c                                    |  4 +--
 fs/tracefs/inode.c                                 |  2 +-
 fs/ubifs/dir.c                                     | 10 +++----
 fs/ubifs/file.c                                    | 12 ++++----
 fs/ubifs/ioctl.c                                   |  2 +-
 fs/ubifs/misc.h                                    | 10 -------
 fs/ubifs/sb.c                                      | 18 ++++++++---
 fs/ubifs/xattr.c                                   |  6 ++--
 fs/udf/super.c                                     |  4 +--
 fs/ufs/dir.c                                       |  6 ++--
 fs/ufs/ialloc.c                                    |  8 +++--
 fs/ufs/inode.c                                     |  6 ++--
 fs/ufs/namei.c                                     |  6 ++--
 include/linux/audit.h                              |  4 +--
 include/linux/time.h                               | 18 ++++++++---
 ipc/mqueue.c                                       | 21 ++++++-------
 kernel/audit.c                                     | 10 +++----
 kernel/audit.h                                     |  2 +-
 kernel/auditsc.c                                   |  6 ++--
 kernel/bpf/inode.c                                 |  2 +-
 kernel/time/timeconv.c                             | 11 +++----
 mm/shmem.c                                         | 26 ++++++++--------
 net/ceph/messenger.c                               |  6 ++--
 net/ceph/osd_client.c                              |  4 +--
 net/sunrpc/rpc_pipe.c                              |  2 +-
 security/inode.c                                   |  2 +-
 security/selinux/selinuxfs.c                       |  2 +-
 173 files changed, 494 insertions(+), 458 deletions(-)

-- 
1.9.1

Cc: Anna Schumaker <anna.schumaker@netapp.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Benny Halevy <bhalevy@primarydata.com>
Cc: Boaz Harrosh <ooo@electrozaur.com>
Cc: Changman Lee <cm224.lee@samsung.com>
Cc: Chris Mason <clm@fb.com>
Cc: Colin Cross <ccross@android.com>
Cc: Dave Kleikamp <shaggy@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: David Sterba <dsterba@suse.com>
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Ian Kent <raven@themaw.net>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Joern Engel <joern@logfs.org>
Cc: Josef Bacik <jbacik@fb.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Matthew Garrett <matthew.garrett@nebula.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Nadia Yvette Chambers <nyc@holomorphy.com>
Cc: Prasad Joshi <prasadjoshi.linux@gmail.com>
Cc: Robert Richter <rric@kernel.org>
Cc: Ron Minnich <rminnich@sandia.gov>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: autofs@vger.kernel.org
Cc: cluster-devel@redhat.com
Cc: jfs-discussion@lists.sourceforge.net
Cc: linux-btrfs@vger.kernel.org
Cc: linux-efi@vger.kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: linux-nfs@vger.kernel.org
Cc: linux-nilfs@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-rdma@vger.kernel.org
Cc: linux-s390@vger.kernel.org
Cc: linux-security-module@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: logfs@logfs.org
Cc: netdev@vger.kernel.org
Cc: ocfs2-devel@oss.oracle.com
Cc: oprofile-list@lists.sf.net
Cc: osd-dev@open-osd.org
Cc: selinux@tycho.nsa.gov
Cc: v9fs-developer@lists.sourceforge.net

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
@ 2016-06-09  5:04 ` Deepa Dinamani
  2016-06-09  7:35   ` Jan Kara
                     ` (2 more replies)
  2016-06-09  5:04 ` [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps Deepa Dinamani
                   ` (19 subsequent siblings)
  20 siblings, 3 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Artem Bityutskiy, Adrian Hunter, linux-mtd, Evgeniy Dushistov,
	OGAWA Hirofumi, Jan Kara, linux-ext4, David Howells, linux-afs,
	Tigran A. Aivazian, Theodore Ts'o, Andreas Dilger, Jan Kara,
	Jan Harkes, coda, codalist, Bob Copeland, linux-karma-devel,
	Christoph Hellwig

CURRENT_TIME_SEC is not y2038 safe. current_fs_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_fs_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.

Also note that filesystem specific times like the birthtime,
creation time that were using same interfaces to obtain time
retain same logistics.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: linux-mtd@lists.infradead.org
Cc: Evgeniy Dushistov <dushistov@mail.ru>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Jan Kara <jack@suse.com>
Cc: linux-ext4@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>
Cc: linux-afs@lists.infradead.org
Cc: "Tigran A. Aivazian" <tigran@aivazian.fsnet.co.uk>
Cc: linux-fsdevel@vger.kernel.org
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Jan Kara <jack@suse.cz>
Cc: Jan Harkes <jaharkes@cs.cmu.edu>
Cc: coda@cs.cmu.edu
Cc: codalist@coda.cs.cmu.edu
Cc: Bob Copeland <me@bobcopeland.com>
Cc: linux-karma-devel@lists.sourceforge.net
Cc: Christoph Hellwig <hch@infradead.org>
---
 fs/affs/amigaffs.c      |  6 +++---
 fs/affs/inode.c         |  2 +-
 fs/afs/inode.c          |  3 +--
 fs/bfs/dir.c            | 18 ++++++++++--------
 fs/coda/dir.c           |  2 +-
 fs/coda/file.c          |  2 +-
 fs/coda/inode.c         |  2 +-
 fs/ext2/acl.c           |  2 +-
 fs/ext2/dir.c           |  6 +++---
 fs/ext2/ialloc.c        |  2 +-
 fs/ext2/inode.c         |  4 ++--
 fs/ext2/ioctl.c         |  5 +++--
 fs/ext2/namei.c         |  6 +++---
 fs/ext2/super.c         |  2 +-
 fs/ext2/xattr.c         |  2 +-
 fs/fat/dir.c            |  2 +-
 fs/fat/file.c           |  4 ++--
 fs/fat/inode.c          |  2 +-
 fs/fat/namei_msdos.c    | 13 +++++++------
 fs/fat/namei_vfat.c     | 10 +++++-----
 fs/hfs/catalog.c        |  8 ++++----
 fs/hfs/dir.c            |  2 +-
 fs/hfs/inode.c          |  2 +-
 fs/hfsplus/catalog.c    |  8 ++++----
 fs/hfsplus/dir.c        |  6 +++---
 fs/hfsplus/inode.c      |  2 +-
 fs/hfsplus/ioctl.c      |  2 +-
 fs/jffs2/acl.c          |  2 +-
 fs/jffs2/fs.c           |  2 +-
 fs/minix/bitmap.c       |  2 +-
 fs/minix/dir.c          | 12 +++++++-----
 fs/minix/itree_common.c |  4 ++--
 fs/minix/namei.c        |  4 ++--
 fs/omfs/dir.c           |  4 ++--
 fs/omfs/inode.c         |  2 +-
 fs/reiserfs/inode.c     |  2 +-
 fs/reiserfs/ioctl.c     |  4 ++--
 fs/reiserfs/namei.c     | 14 +++++++-------
 fs/reiserfs/stree.c     |  6 ++----
 fs/reiserfs/super.c     |  2 +-
 fs/reiserfs/xattr.c     |  2 +-
 fs/reiserfs/xattr_acl.c |  2 +-
 fs/sysv/dir.c           |  6 +++---
 fs/sysv/ialloc.c        |  2 +-
 fs/sysv/itree.c         |  4 ++--
 fs/sysv/namei.c         |  4 ++--
 fs/ufs/dir.c            |  6 +++---
 fs/ufs/ialloc.c         |  8 +++++---
 fs/ufs/inode.c          |  6 +++---
 fs/ufs/namei.c          |  6 +++---
 50 files changed, 118 insertions(+), 113 deletions(-)

diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index d6c7a51..015b62c 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -58,7 +58,7 @@ affs_insert_hash(struct inode *dir, struct buffer_head *bh)
 	mark_buffer_dirty_inode(dir_bh, dir);
 	affs_brelse(dir_bh);
 
-	dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+	dir->i_mtime = dir->i_ctime = current_fs_time(sb);
 	dir->i_version++;
 	mark_inode_dirty(dir);
 
@@ -112,7 +112,7 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh)
 
 	affs_brelse(bh);
 
-	dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+	dir->i_mtime = dir->i_ctime = current_fs_time(sb);
 	dir->i_version++;
 	mark_inode_dirty(dir);
 
@@ -313,7 +313,7 @@ affs_remove_header(struct dentry *dentry)
 	else
 		clear_nlink(inode);
 	affs_unlock_link(inode);
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	mark_inode_dirty(inode);
 
 done:
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index 0fdb0f5..cdd6d64 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -309,7 +309,7 @@ affs_new_inode(struct inode *dir)
 	inode->i_gid     = current_fsgid();
 	inode->i_ino     = block;
 	set_nlink(inode, 1);
-	inode->i_mtime   = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_mtime   = inode->i_atime = inode->i_ctime = current_fs_time(sb);
 	atomic_set(&AFFS_I(inode)->i_opencnt, 0);
 	AFFS_I(inode)->i_blkcnt = 0;
 	AFFS_I(inode)->i_lc = NULL;
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 86cc726..ce3374b 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -178,8 +178,7 @@ struct inode *afs_iget_autocell(struct inode *dir, const char *dev_name,
 	set_nlink(inode, 2);
 	inode->i_uid		= GLOBAL_ROOT_UID;
 	inode->i_gid		= GLOBAL_ROOT_GID;
-	inode->i_ctime.tv_sec	= get_seconds();
-	inode->i_ctime.tv_nsec	= 0;
+	inode->i_ctime		= current_fs_time(sb);
 	inode->i_atime		= inode->i_mtime = inode->i_ctime;
 	inode->i_blocks		= 0;
 	inode->i_version	= 0;
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 34a5bc2..fcbb2a4 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -97,7 +97,7 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 	set_bit(ino, info->si_imap);
 	info->si_freei--;
 	inode_init_owner(inode, dir, mode);
-	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_mtime = inode->i_atime = inode->i_ctime = current_fs_time(s);
 	inode->i_blocks = 0;
 	inode->i_op = &bfs_file_inops;
 	inode->i_fop = &bfs_file_operations;
@@ -154,7 +154,8 @@ static int bfs_link(struct dentry *old, struct inode *dir,
 						struct dentry *new)
 {
 	struct inode *inode = d_inode(old);
-	struct bfs_sb_info *info = BFS_SB(inode->i_sb);
+	struct super_block *s = inode->i_sb;
+	struct bfs_sb_info *info = BFS_SB(s);
 	int err;
 
 	mutex_lock(&info->bfs_lock);
@@ -165,7 +166,7 @@ static int bfs_link(struct dentry *old, struct inode *dir,
 		return err;
 	}
 	inc_nlink(inode);
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(s);
 	mark_inode_dirty(inode);
 	ihold(inode);
 	d_instantiate(new, inode);
@@ -194,7 +195,7 @@ static int bfs_unlink(struct inode *dir, struct dentry *dentry)
 	}
 	de->ino = 0;
 	mark_buffer_dirty_inode(bh, dir);
-	dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
+	dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
 	mark_inode_dirty(dir);
 	inode->i_ctime = dir->i_ctime;
 	inode_dec_link_count(inode);
@@ -249,10 +250,10 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 			goto end_rename;
 	}
 	old_de->ino = 0;
-	old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
+	old_dir->i_ctime = old_dir->i_mtime = current_fs_time(old_dir->i_sb);
 	mark_inode_dirty(old_dir);
 	if (new_inode) {
-		new_inode->i_ctime = CURRENT_TIME_SEC;
+		new_inode->i_ctime = current_fs_time(new_dir->i_sb);
 		inode_dec_link_count(new_inode);
 	}
 	mark_buffer_dirty_inode(old_bh, old_dir);
@@ -278,6 +279,7 @@ static int bfs_add_entry(struct inode *dir, const unsigned char *name,
 {
 	struct buffer_head *bh;
 	struct bfs_dirent *de;
+	struct super_block *s = dir->i_sb;
 	int block, sblock, eblock, off, pos;
 	int i;
 
@@ -300,9 +302,9 @@ static int bfs_add_entry(struct inode *dir, const unsigned char *name,
 				pos = (block - sblock) * BFS_BSIZE + off;
 				if (pos >= dir->i_size) {
 					dir->i_size += BFS_DIRENT_SIZE;
-					dir->i_ctime = CURRENT_TIME_SEC;
+					dir->i_ctime = current_fs_time(s);
 				}
-				dir->i_mtime = CURRENT_TIME_SEC;
+				dir->i_mtime = current_fs_time(s);
 				mark_inode_dirty(dir);
 				de->ino = cpu_to_le16((u16)ino);
 				for (i = 0; i < BFS_NAMELEN; i++)
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 6fb8672..4f97929 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -109,7 +109,7 @@ static inline void coda_dir_update_mtime(struct inode *dir)
 	/* optimistically we can also act as if our nose bleeds. The
 	 * granularity of the mtime is coarse anyways so we might actually be
 	 * right most of the time. Note: we only do this for directories. */
-	dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+	dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
 #endif
 }
 
diff --git a/fs/coda/file.c b/fs/coda/file.c
index f47c748..8643545 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -75,7 +75,7 @@ coda_file_write_iter(struct kiocb *iocb, struct iov_iter *to)
 	ret = vfs_iter_write(cfi->cfi_container, to, &iocb->ki_pos);
 	coda_inode->i_size = file_inode(host_file)->i_size;
 	coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9;
-	coda_inode->i_mtime = coda_inode->i_ctime = CURRENT_TIME_SEC;
+	coda_inode->i_mtime = coda_inode->i_ctime = current_fs_time(coda_inode->i_sb);
 	inode_unlock(coda_inode);
 	file_end_write(host_file);
 	return ret;
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index 57e81cb..3894447 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -271,7 +271,7 @@ int coda_setattr(struct dentry *de, struct iattr *iattr)
 
 	memset(&vattr, 0, sizeof(vattr)); 
 
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	coda_iattr_to_vattr(iattr, &vattr);
 	vattr.va_type = C_VNON; /* cannot set type */
 
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index 42f1d18..3b1a030 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)
 				if (error < 0)
 					return error;
 				else {
-					inode->i_ctime = CURRENT_TIME_SEC;
+					inode->i_ctime = current_fs_time(inode->i_sb);
 					mark_inode_dirty(inode);
 					if (error == 0)
 						acl = NULL;
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 19efd11..3fa63ab 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,
 	err = ext2_commit_chunk(page, pos, len);
 	ext2_put_page(page);
 	if (update_times)
-		dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+		dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
 	EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
 	mark_inode_dirty(dir);
 }
@@ -561,7 +561,7 @@ got_it:
 	de->inode = cpu_to_le32(inode->i_ino);
 	ext2_set_de_type (de, inode);
 	err = ext2_commit_chunk(page, pos, rec_len);
-	dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+	dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
 	EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
 	mark_inode_dirty(dir);
 	/* OFFSET_CACHE */
@@ -610,7 +610,7 @@ int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page )
 		pde->rec_len = ext2_rec_len_to_disk(to - from);
 	dir->inode = 0;
 	err = ext2_commit_chunk(page, pos, to - from);
-	inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
+	inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb);
 	EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL;
 	mark_inode_dirty(inode);
 out:
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index efe5fb2..13d88a2 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -551,7 +551,7 @@ got:
 
 	inode->i_ino = ino;
 	inode->i_blocks = 0;
-	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_mtime = inode->i_atime = inode->i_ctime = current_fs_time(sb);
 	memset(ei->i_data, 0, sizeof(ei->i_data));
 	ei->i_flags =
 		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 fcbe586..f5f655c 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -594,7 +594,7 @@ static void ext2_splice_branch(struct inode *inode,
 	if (where->bh)
 		mark_buffer_dirty_inode(where->bh, inode);
 
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	mark_inode_dirty(inode);
 }
 
@@ -1236,7 +1236,7 @@ static int ext2_setsize(struct inode *inode, loff_t newsize)
 	__ext2_truncate_blocks(inode, newsize);
 	dax_sem_up_write(EXT2_I(inode));
 
-	inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
 	if (inode_needs_sync(inode)) {
 		sync_mapping_buffers(inode->i_mapping);
 		sync_inode_metadata(inode, 1);
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c
index b386af2..1cbb75b 100644
--- a/fs/ext2/ioctl.c
+++ b/fs/ext2/ioctl.c
@@ -21,6 +21,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
 	struct inode *inode = file_inode(filp);
 	struct ext2_inode_info *ei = EXT2_I(inode);
+	struct super_block *sb = inode->i_sb;
 	unsigned int flags;
 	unsigned short rsv_window_size;
 	int ret;
@@ -79,7 +80,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		ei->i_flags = flags;
 
 		ext2_set_inode_flags(inode);
-		inode->i_ctime = CURRENT_TIME_SEC;
+		inode->i_ctime = current_fs_time(sb);
 		inode_unlock(inode);
 
 		mark_inode_dirty(inode);
@@ -103,7 +104,7 @@ setflags_out:
 		}
 
 		inode_lock(inode);
-		inode->i_ctime = CURRENT_TIME_SEC;
+		inode->i_ctime = current_fs_time(sb);
 		inode->i_generation = generation;
 		inode_unlock(inode);
 
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index d446203..7109cb3 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,
 	if (err)
 		return err;
 
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	inode_inc_link_count(inode);
 	ihold(inode);
 
@@ -372,7 +372,7 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
 		if (!new_de)
 			goto out_dir;
 		ext2_set_link(new_dir, new_de, new_page, old_inode, 1);
-		new_inode->i_ctime = CURRENT_TIME_SEC;
+		new_inode->i_ctime = current_fs_time(new_inode->i_sb);
 		if (dir_de)
 			drop_nlink(new_inode);
 		inode_dec_link_count(new_inode);
@@ -388,7 +388,7 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
 	 * Like most other Unix systems, set the ctime for inodes on a
  	 * rename.
 	 */
-	old_inode->i_ctime = CURRENT_TIME_SEC;
+	old_inode->i_ctime = current_fs_time(old_inode->i_sb);
 	mark_inode_dirty(old_inode);
 
 	ext2_delete_entry (old_de, old_page);
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 1d93795..3ead2de 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1543,7 +1543,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_fs_time(sb);
 	mark_inode_dirty(inode);
 	return len - towrite;
 }
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 1a5e3bf..8ff1494 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,
 
 	/* Update the inode. */
 	EXT2_I(inode)->i_file_acl = new_bh ? new_bh->b_blocknr : 0;
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(sb);
 	if (IS_SYNC(inode)) {
 		error = sync_inode_metadata(inode, 1);
 		/* In case sync failed due to ENOSPC the inode was actually
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 663e428..eb0ecb0 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -1071,7 +1071,7 @@ int fat_remove_entries(struct inode *dir, struct fat_slot_info *sinfo)
 		}
 	}
 
-	dir->i_mtime = dir->i_atime = CURRENT_TIME_SEC;
+	dir->i_mtime = dir->i_atime = current_fs_time(sb);
 	if (IS_DIRSYNC(dir))
 		(void)fat_sync_inode(dir);
 	else
diff --git a/fs/fat/file.c b/fs/fat/file.c
index f701856..1f9f172 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -194,7 +194,7 @@ static int fat_cont_expand(struct inode *inode, loff_t size)
 	if (err)
 		goto out;
 
-	inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
+	inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb);
 	mark_inode_dirty(inode);
 	if (IS_SYNC(inode)) {
 		int err2;
@@ -297,7 +297,7 @@ static int fat_free(struct inode *inode, int skip)
 		MSDOS_I(inode)->i_logstart = 0;
 	}
 	MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
-	inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
+	inode->i_ctime = inode->i_mtime = current_fs_time(sb);
 	if (wait) {
 		err = fat_sync_inode(inode);
 		if (err) {
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 3bcf579..7dd9af7 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -237,7 +237,7 @@ static int fat_write_end(struct file *file, struct address_space *mapping,
 	if (err < len)
 		fat_write_failed(mapping, pos + len);
 	if (!(err < 0) && !(MSDOS_I(inode)->i_attrs & ATTR_ARCH)) {
-		inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
+		inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
 		MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
 		mark_inode_dirty(inode);
 	}
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
index b7e2b33..c54888f 100644
--- a/fs/fat/namei_msdos.c
+++ b/fs/fat/namei_msdos.c
@@ -283,7 +283,7 @@ static int msdos_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 		goto out;
 	}
 
-	ts = CURRENT_TIME_SEC;
+	ts = current_fs_time(sb);
 	err = msdos_add_entry(dir, msdos_name, 0, is_hid, 0, &ts, &sinfo);
 	if (err)
 		goto out;
@@ -330,7 +330,7 @@ static int msdos_rmdir(struct inode *dir, struct dentry *dentry)
 	drop_nlink(dir);
 
 	clear_nlink(inode);
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(sb);
 	fat_detach(inode);
 out:
 	mutex_unlock(&MSDOS_SB(sb)->s_lock);
@@ -364,7 +364,7 @@ static int msdos_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 		goto out;
 	}
 
-	ts = CURRENT_TIME_SEC;
+	ts = current_fs_time(sb);
 	cluster = fat_alloc_new_dir(dir, &ts);
 	if (cluster < 0) {
 		err = cluster;
@@ -416,7 +416,7 @@ static int msdos_unlink(struct inode *dir, struct dentry *dentry)
 	if (err)
 		goto out;
 	clear_nlink(inode);
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(sb);
 	fat_detach(inode);
 out:
 	mutex_unlock(&MSDOS_SB(sb)->s_lock);
@@ -481,7 +481,8 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
 				mark_inode_dirty(old_inode);
 
 			old_dir->i_version++;
-			old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
+			old_dir->i_ctime = old_dir->i_mtime =
+				current_fs_time(old_dir->i_sb);
 			if (IS_DIRSYNC(old_dir))
 				(void)fat_sync_inode(old_dir);
 			else
@@ -490,7 +491,7 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
 		}
 	}
 
-	ts = CURRENT_TIME_SEC;
+	ts = current_fs_time(new_inode->i_sb);
 	if (new_inode) {
 		if (err)
 			goto out;
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index 7092584..cad8666 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -777,7 +777,7 @@ static int vfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 
 	mutex_lock(&MSDOS_SB(sb)->s_lock);
 
-	ts = CURRENT_TIME_SEC;
+	ts = current_fs_time(sb);
 	err = vfat_add_entry(dir, &dentry->d_name, 0, 0, &ts, &sinfo);
 	if (err)
 		goto out;
@@ -821,7 +821,7 @@ static int vfat_rmdir(struct inode *dir, struct dentry *dentry)
 	drop_nlink(dir);
 
 	clear_nlink(inode);
-	inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC;
+	inode->i_mtime = inode->i_atime = current_fs_time(sb);
 	fat_detach(inode);
 	dentry->d_time = dir->i_version;
 out:
@@ -847,7 +847,7 @@ static int vfat_unlink(struct inode *dir, struct dentry *dentry)
 	if (err)
 		goto out;
 	clear_nlink(inode);
-	inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC;
+	inode->i_mtime = inode->i_atime = current_fs_time(sb);
 	fat_detach(inode);
 	dentry->d_time = dir->i_version;
 out:
@@ -866,7 +866,7 @@ static int vfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 
 	mutex_lock(&MSDOS_SB(sb)->s_lock);
 
-	ts = CURRENT_TIME_SEC;
+	ts = current_fs_time(sb);
 	cluster = fat_alloc_new_dir(dir, &ts);
 	if (cluster < 0) {
 		err = cluster;
@@ -931,7 +931,7 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
 		}
 	}
 
-	ts = CURRENT_TIME_SEC;
+	ts = current_fs_time(sb);
 	if (new_inode) {
 		if (is_dir) {
 			err = fat_dir_empty(new_inode);
diff --git a/fs/hfs/catalog.c b/fs/hfs/catalog.c
index 98cde8b..0fabf66 100644
--- a/fs/hfs/catalog.c
+++ b/fs/hfs/catalog.c
@@ -125,7 +125,7 @@ int hfs_cat_create(u32 cnid, struct inode *dir, struct qstr *str, struct inode *
 		goto err1;
 
 	dir->i_size++;
-	dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+	dir->i_mtime = dir->i_ctime = current_fs_time(sb);
 	mark_inode_dirty(dir);
 	hfs_find_exit(&fd);
 	return 0;
@@ -261,7 +261,7 @@ int hfs_cat_delete(u32 cnid, struct inode *dir, struct qstr *str)
 	}
 
 	dir->i_size--;
-	dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+	dir->i_mtime = dir->i_ctime = current_fs_time(sb);
 	mark_inode_dirty(dir);
 	res = 0;
 out:
@@ -321,7 +321,7 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, struct qstr *src_name,
 	if (err)
 		goto out;
 	dst_dir->i_size++;
-	dst_dir->i_mtime = dst_dir->i_ctime = CURRENT_TIME_SEC;
+	dst_dir->i_mtime = dst_dir->i_ctime = current_fs_time(dst_dir->i_sb);
 	mark_inode_dirty(dst_dir);
 
 	/* finally remove the old entry */
@@ -333,7 +333,7 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, struct qstr *src_name,
 	if (err)
 		goto out;
 	src_dir->i_size--;
-	src_dir->i_mtime = src_dir->i_ctime = CURRENT_TIME_SEC;
+	src_dir->i_mtime = src_dir->i_ctime = current_fs_time(sb);
 	mark_inode_dirty(src_dir);
 
 	type = entry.type;
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 163190e..d64c536 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -268,7 +268,7 @@ static int hfs_remove(struct inode *dir, struct dentry *dentry)
 	if (res)
 		return res;
 	clear_nlink(inode);
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	hfs_delete_inode(inode);
 	mark_inode_dirty(inode);
 	return 0;
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 8eed66a..b30b6d2 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -193,7 +193,7 @@ struct inode *hfs_new_inode(struct inode *dir, struct qstr *name, umode_t mode)
 	inode->i_uid = current_fsuid();
 	inode->i_gid = current_fsgid();
 	set_nlink(inode, 1);
-	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_mtime = inode->i_atime = inode->i_ctime = current_fs_time(sb);
 	HFS_I(inode)->flags = 0;
 	HFS_I(inode)->rsrc_inode = NULL;
 	HFS_I(inode)->fs_blocks = 0;
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c
index fb707e8..b2f9093 100644
--- a/fs/hfsplus/catalog.c
+++ b/fs/hfsplus/catalog.c
@@ -303,7 +303,7 @@ int hfsplus_create_cat(u32 cnid, struct inode *dir,
 	dir->i_size++;
 	if (S_ISDIR(inode->i_mode))
 		hfsplus_subfolders_inc(dir);
-	dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+	dir->i_mtime = dir->i_ctime = current_fs_time(sb);
 	hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY);
 
 	hfs_find_exit(&fd);
@@ -400,7 +400,7 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, struct qstr *str)
 	dir->i_size--;
 	if (type == HFSPLUS_FOLDER)
 		hfsplus_subfolders_dec(dir);
-	dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+	dir->i_mtime = dir->i_ctime = current_fs_time(sb);
 	hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY);
 
 	if (type == HFSPLUS_FILE || type == HFSPLUS_FOLDER) {
@@ -469,7 +469,7 @@ int hfsplus_rename_cat(u32 cnid,
 	dst_dir->i_size++;
 	if (type == HFSPLUS_FOLDER)
 		hfsplus_subfolders_inc(dst_dir);
-	dst_dir->i_mtime = dst_dir->i_ctime = CURRENT_TIME_SEC;
+	dst_dir->i_mtime = dst_dir->i_ctime = current_fs_time(dst_dir->i_sb);
 
 	/* finally remove the old entry */
 	err = hfsplus_cat_build_key(sb, src_fd.search_key,
@@ -486,7 +486,7 @@ int hfsplus_rename_cat(u32 cnid,
 	src_dir->i_size--;
 	if (type == HFSPLUS_FOLDER)
 		hfsplus_subfolders_dec(src_dir);
-	src_dir->i_mtime = src_dir->i_ctime = CURRENT_TIME_SEC;
+	src_dir->i_mtime = src_dir->i_ctime = current_fs_time(sb);
 
 	/* remove old thread entry */
 	hfsplus_cat_build_key_with_cnid(sb, src_fd.search_key, cnid);
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 42e1286..f5b40db 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -347,7 +347,7 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir,
 	inc_nlink(inode);
 	hfsplus_instantiate(dst_dentry, inode, cnid);
 	ihold(inode);
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	mark_inode_dirty(inode);
 	sbi->file_count++;
 	hfsplus_mark_mdb_dirty(dst_dir->i_sb);
@@ -406,7 +406,7 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry)
 			hfsplus_delete_inode(inode);
 	} else
 		sbi->file_count--;
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	mark_inode_dirty(inode);
 out:
 	mutex_unlock(&sbi->vh_mutex);
@@ -427,7 +427,7 @@ static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry)
 	if (res)
 		goto out;
 	clear_nlink(inode);
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	hfsplus_delete_inode(inode);
 	mark_inode_dirty(inode);
 out:
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index ef9fefe..d0f0ee2 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -369,7 +369,7 @@ struct inode *hfsplus_new_inode(struct super_block *sb, umode_t mode)
 	inode->i_uid = current_fsuid();
 	inode->i_gid = current_fsgid();
 	set_nlink(inode, 1);
-	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_mtime = inode->i_atime = inode->i_ctime = current_fs_time(sb);
 
 	hip = HFSPLUS_I(inode);
 	INIT_LIST_HEAD(&hip->open_dir_list);
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c
index 32a49e2..7b4820b 100644
--- a/fs/hfsplus/ioctl.c
+++ b/fs/hfsplus/ioctl.c
@@ -122,7 +122,7 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
 	else
 		hip->userflags &= ~HFSPLUS_FLG_NODUMP;
 
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	mark_inode_dirty(inode);
 
 out_unlock_inode:
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index bc2693d..f8c7308 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -242,7 +242,7 @@ int jffs2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
 
 				attr.ia_valid = ATTR_MODE | ATTR_CTIME;
 				attr.ia_mode = mode;
-				attr.ia_ctime = CURRENT_TIME_SEC;
+				attr.ia_ctime = current_fs_time(inode->i_sb);
 				rc = jffs2_do_setattr(inode, &attr);
 				if (rc < 0)
 					return rc;
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index ae2ebb2..2ce4091 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -472,7 +472,7 @@ struct inode *jffs2_new_inode (struct inode *dir_i, umode_t mode, struct jffs2_r
 	inode->i_mode = jemode_to_cpu(ri->mode);
 	i_gid_write(inode, je16_to_cpu(ri->gid));
 	i_uid_write(inode, je16_to_cpu(ri->uid));
-	inode->i_atime = inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
+	inode->i_atime = inode->i_ctime = inode->i_mtime = current_fs_time(sb);
 	ri->atime = ri->mtime = ri->ctime = cpu_to_je32(I_SEC(inode->i_mtime));
 
 	inode->i_blocks = 0;
diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c
index 742942a..0e72667 100644
--- a/fs/minix/bitmap.c
+++ b/fs/minix/bitmap.c
@@ -253,7 +253,7 @@ struct inode *minix_new_inode(const struct inode *dir, umode_t mode, int *error)
 	}
 	inode_init_owner(inode, dir, mode);
 	inode->i_ino = j;
-	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_mtime = inode->i_atime = inode->i_ctime = current_fs_time(sb);
 	inode->i_blocks = 0;
 	memset(&minix_i(inode)->u, 0, sizeof(minix_i(inode)->u));
 	insert_inode_hash(inode);
diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index 31dcd51..d86a1aa 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -274,7 +274,7 @@ got_it:
 		de->inode = inode->i_ino;
 	}
 	err = dir_commit_chunk(page, pos, sbi->s_dirsize);
-	dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+	dir->i_mtime = dir->i_ctime = current_fs_time(sb);
 	mark_inode_dirty(dir);
 out_put:
 	dir_put_page(page);
@@ -290,7 +290,8 @@ int minix_delete_entry(struct minix_dir_entry *de, struct page *page)
 	struct inode *inode = page->mapping->host;
 	char *kaddr = page_address(page);
 	loff_t pos = page_offset(page) + (char*)de - kaddr;
-	struct minix_sb_info *sbi = minix_sb(inode->i_sb);
+	struct super_block *sb = inode->i_sb;
+	struct minix_sb_info *sbi = minix_sb(sb);
 	unsigned len = sbi->s_dirsize;
 	int err;
 
@@ -306,7 +307,7 @@ int minix_delete_entry(struct minix_dir_entry *de, struct page *page)
 		unlock_page(page);
 	}
 	dir_put_page(page);
-	inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
+	inode->i_ctime = inode->i_mtime = current_fs_time(sb);
 	mark_inode_dirty(inode);
 	return err;
 }
@@ -412,7 +413,8 @@ void minix_set_link(struct minix_dir_entry *de, struct page *page,
 	struct inode *inode)
 {
 	struct inode *dir = page->mapping->host;
-	struct minix_sb_info *sbi = minix_sb(dir->i_sb);
+	struct super_block *sb = dir->i_sb;
+	struct minix_sb_info *sbi = minix_sb(sb);
 	loff_t pos = page_offset(page) +
 			(char *)de-(char*)page_address(page);
 	int err;
@@ -430,7 +432,7 @@ void minix_set_link(struct minix_dir_entry *de, struct page *page,
 		unlock_page(page);
 	}
 	dir_put_page(page);
-	dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+	dir->i_mtime = dir->i_ctime = current_fs_time(sb);
 	mark_inode_dirty(dir);
 }
 
diff --git a/fs/minix/itree_common.c b/fs/minix/itree_common.c
index a731cab..89d9288 100644
--- a/fs/minix/itree_common.c
+++ b/fs/minix/itree_common.c
@@ -124,7 +124,7 @@ static inline int splice_branch(struct inode *inode,
 
 	/* We are done with atomic stuff, now do the rest of housekeeping */
 
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(inode->i_sb);
 
 	/* had we spliced it onto indirect block? */
 	if (where->bh)
@@ -343,7 +343,7 @@ do_indirects:
 		}
 		first_whole++;
 	}
-	inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_mtime = inode->i_ctime = current_fs_time(sb);
 	mark_inode_dirty(inode);
 }
 
diff --git a/fs/minix/namei.c b/fs/minix/namei.c
index 2887d1d..547fc16 100644
--- a/fs/minix/namei.c
+++ b/fs/minix/namei.c
@@ -106,7 +106,7 @@ static int minix_link(struct dentry * old_dentry, struct inode * dir,
 {
 	struct inode *inode = d_inode(old_dentry);
 
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	inode_inc_link_count(inode);
 	ihold(inode);
 	return add_nondir(dentry, inode);
@@ -219,7 +219,7 @@ static int minix_rename(struct inode * old_dir, struct dentry *old_dentry,
 		if (!new_de)
 			goto out_dir;
 		minix_set_link(new_de, new_page, old_inode);
-		new_inode->i_ctime = CURRENT_TIME_SEC;
+		new_inode->i_ctime = current_fs_time(new_inode->i_sb);
 		if (dir_de)
 			drop_nlink(new_inode);
 		inode_dec_link_count(new_inode);
diff --git a/fs/omfs/dir.c b/fs/omfs/dir.c
index c8cbf3b..ce3e6eb 100644
--- a/fs/omfs/dir.c
+++ b/fs/omfs/dir.c
@@ -143,7 +143,7 @@ static int omfs_add_link(struct dentry *dentry, struct inode *inode)
 	mark_buffer_dirty(bh);
 	brelse(bh);
 
-	dir->i_ctime = CURRENT_TIME_SEC;
+	dir->i_ctime = current_fs_time(dir->i_sb);
 
 	/* mark affected inodes dirty to rebuild checksums */
 	mark_inode_dirty(dir);
@@ -395,7 +395,7 @@ static int omfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	if (err)
 		goto out;
 
-	old_inode->i_ctime = CURRENT_TIME_SEC;
+	old_inode->i_ctime = current_fs_time(old_inode->i_sb);
 	mark_inode_dirty(old_inode);
 out:
 	return err;
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index 3d935c8..0f0b65e 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -49,7 +49,7 @@ struct inode *omfs_new_inode(struct inode *dir, umode_t mode)
 	inode_init_owner(inode, NULL, mode);
 	inode->i_mapping->a_ops = &omfs_aops;
 
-	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);
 	switch (mode & S_IFMT) {
 	case S_IFDIR:
 		inode->i_op = &omfs_dir_inops;
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 825455d..a70378d 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -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_fs_time(sb);
 	inode->i_size = i_size;
 	inode->i_blocks = 0;
 	inode->i_bytes = 0;
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
index 2f1ddc9..30faa08 100644
--- a/fs/reiserfs/ioctl.c
+++ b/fs/reiserfs/ioctl.c
@@ -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_fs_time(inode->i_sb);
 			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_fs_time(inode->i_sb);
 		mark_inode_dirty(inode);
 setversion_out:
 		mnt_drop_write_file(filp);
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 8a36696..d9e54b4 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -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_fs_time(dir->i_sb);
 	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_fs_time(inode->i_sb);
 	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_fs_time(inode->i_sb);
 	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_fs_time(dir->i_sb);
 	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_fs_time(inode->i_sb);
 	reiserfs_update_sd(&th, inode);
 
 	ihold(inode);
@@ -1567,14 +1567,14 @@ 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_fs_time(old_dir->i_sb);
 	old_dir->i_ctime = old_dir->i_mtime = ctime;
 	new_dir->i_ctime = new_dir->i_mtime = ctime;
 	/*
 	 * thanks to Alex Adriaanse <alex_a@caltech.edu> for patch
 	 * which adds ctime update of renamed object
 	 */
-	old_inode->i_ctime = ctime;
+	old_inode->i_ctime = current_fs_time(old_inode->i_sb);
 
 	if (new_dentry_inode) {
 		/* adjust link number of the victim */
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index 5feacd6..7aebba07 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -1987,8 +1987,7 @@ 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_ctime = inode->i_mtime = current_fs_time(inode->i_sb);
 			}
 			reiserfs_update_sd(th, inode);
 
@@ -2012,8 +2011,7 @@ 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_ctime = inode->i_mtime = current_fs_time(inode->i_sb);
 	}
 	reiserfs_update_sd(th, inode);
 
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index c72c16c..dd58cf9 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -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_fs_time(sb);
 	mark_inode_dirty(inode);
 	return len - towrite;
 }
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index a33812a..ada620b 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -456,7 +456,7 @@ static void update_ctime(struct inode *inode)
 	    timespec_equal(&inode->i_ctime, &now))
 		return;
 
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	mark_inode_dirty(inode);
 }
 
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
index dbed42f..cf826f6 100644
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -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_fs_time(inode->i_sb);
 			mark_inode_dirty(inode);
 		}
 	}
diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c
index 2661b77..d4f60f4 100644
--- a/fs/sysv/dir.c
+++ b/fs/sysv/dir.c
@@ -215,7 +215,7 @@ got_it:
 	memset (de->name + namelen, 0, SYSV_DIRSIZE - namelen - 2);
 	de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino);
 	err = dir_commit_chunk(page, pos, SYSV_DIRSIZE);
-	dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+	dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
 	mark_inode_dirty(dir);
 out_page:
 	dir_put_page(page);
@@ -239,7 +239,7 @@ int sysv_delete_entry(struct sysv_dir_entry *de, struct page *page)
 	de->inode = 0;
 	err = dir_commit_chunk(page, pos, SYSV_DIRSIZE);
 	dir_put_page(page);
-	inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
+	inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb);
 	mark_inode_dirty(inode);
 	return err;
 }
@@ -337,7 +337,7 @@ void sysv_set_link(struct sysv_dir_entry *de, struct page *page,
 	de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino);
 	err = dir_commit_chunk(page, pos, SYSV_DIRSIZE);
 	dir_put_page(page);
-	dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+	dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
 	mark_inode_dirty(dir);
 }
 
diff --git a/fs/sysv/ialloc.c b/fs/sysv/ialloc.c
index f9db4eb..8d2ea17 100644
--- a/fs/sysv/ialloc.c
+++ b/fs/sysv/ialloc.c
@@ -164,7 +164,7 @@ struct inode * sysv_new_inode(const struct inode * dir, umode_t mode)
 	dirty_sb(sb);
 	inode_init_owner(inode, dir, mode);
 	inode->i_ino = fs16_to_cpu(sbi, ino);
-	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_mtime = inode->i_atime = inode->i_ctime = current_fs_time(sb);
 	inode->i_blocks = 0;
 	memset(SYSV_I(inode)->i_data, 0, sizeof(SYSV_I(inode)->i_data));
 	SYSV_I(inode)->i_dir_start_lookup = 0;
diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c
index 2fde40a..2654a3d 100644
--- a/fs/sysv/itree.c
+++ b/fs/sysv/itree.c
@@ -178,7 +178,7 @@ static inline int splice_branch(struct inode *inode,
 	*where->p = where->key;
 	write_unlock(&pointers_lock);
 
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(inode->i_sb);
 
 	/* had we spliced it onto indirect block? */
 	if (where->bh)
@@ -418,7 +418,7 @@ do_indirects:
 		}
 		n++;
 	}
-	inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
 	if (IS_SYNC(inode))
 		sysv_sync_inode (inode);
 	else
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c
index 90b60c0..028100d 100644
--- a/fs/sysv/namei.c
+++ b/fs/sysv/namei.c
@@ -120,7 +120,7 @@ static int sysv_link(struct dentry * old_dentry, struct inode * dir,
 {
 	struct inode *inode = d_inode(old_dentry);
 
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	inode_inc_link_count(inode);
 	ihold(inode);
 
@@ -240,7 +240,7 @@ static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry,
 		if (!new_de)
 			goto out_dir;
 		sysv_set_link(new_de, new_page, old_inode);
-		new_inode->i_ctime = CURRENT_TIME_SEC;
+		new_inode->i_ctime = current_fs_time(new_inode->i_sb);
 		if (dir_de)
 			drop_nlink(new_inode);
 		inode_dec_link_count(new_inode);
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
index 57dcced..2f9a600 100644
--- a/fs/ufs/dir.c
+++ b/fs/ufs/dir.c
@@ -100,7 +100,7 @@ void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
 	err = ufs_commit_chunk(page, pos, len);
 	ufs_put_page(page);
 	if (update_times)
-		dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+		dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
 	mark_inode_dirty(dir);
 }
 
@@ -395,7 +395,7 @@ got_it:
 	ufs_set_de_type(sb, de, inode->i_mode);
 
 	err = ufs_commit_chunk(page, pos, rec_len);
-	dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+	dir->i_mtime = dir->i_ctime = current_fs_time(sb);
 
 	mark_inode_dirty(dir);
 	/* OFFSET_CACHE */
@@ -545,7 +545,7 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir,
 		pde->d_reclen = cpu_to_fs16(sb, to - from);
 	dir->d_ino = 0;
 	err = ufs_commit_chunk(page, pos, to - from);
-	inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
+	inode->i_ctime = inode->i_mtime = current_fs_time(sb);
 	mark_inode_dirty(inode);
 out:
 	ufs_put_page(page);
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index fd0203c..6cbf2e3 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -176,6 +176,7 @@ struct inode *ufs_new_inode(struct inode *dir, umode_t mode)
 	struct ufs_cg_private_info * ucpi;
 	struct ufs_cylinder_group * ucg;
 	struct inode * inode;
+	struct timespec ts;
 	unsigned cg, bit, i, j, start;
 	struct ufs_inode_info *ufsi;
 	int err = -ENOSPC;
@@ -290,7 +291,7 @@ cg_found:
 	inode_init_owner(inode, dir, mode);
 	inode->i_blocks = 0;
 	inode->i_generation = 0;
-	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_mtime = inode->i_atime = inode->i_ctime = current_fs_time(sb);
 	ufsi->i_flags = UFS_I(dir)->i_flags;
 	ufsi->i_lastfrag = 0;
 	ufsi->i_shadow = 0;
@@ -323,8 +324,9 @@ cg_found:
 		lock_buffer(bh);
 		ufs2_inode = (struct ufs2_inode *)bh->b_data;
 		ufs2_inode += ufs_inotofsbo(inode->i_ino);
-		ufs2_inode->ui_birthtime = cpu_to_fs64(sb, CURRENT_TIME.tv_sec);
-		ufs2_inode->ui_birthnsec = cpu_to_fs32(sb, CURRENT_TIME.tv_nsec);
+		ts = current_fs_time(sb);
+		ufs2_inode->ui_birthtime = cpu_to_fs64(sb, ts.tv_sec);
+		ufs2_inode->ui_birthnsec = cpu_to_fs32(sb, ts.tv_nsec);
 		mark_buffer_dirty(bh);
 		unlock_buffer(bh);
 		if (sb->s_flags & MS_SYNCHRONOUS)
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 9f49431..f0c6fb5 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -293,7 +293,7 @@ ufs_inode_getfrag(struct inode *inode, unsigned index,
 
 	if (new)
 		*new = 1;
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(sb);
 	if (IS_SYNC(inode))
 		ufs_sync_inode (inode);
 	mark_inode_dirty(inode);
@@ -375,7 +375,7 @@ ufs_inode_getblock(struct inode *inode, u64 ind_block,
 	mark_buffer_dirty(bh);
 	if (IS_SYNC(inode))
 		sync_dirty_buffer(bh);
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(sb);
 	mark_inode_dirty(inode);
 out:
 	brelse (bh);
@@ -1185,7 +1185,7 @@ static int ufs_truncate(struct inode *inode, loff_t size)
 	truncate_setsize(inode, size);
 
 	__ufs_truncate_blocks(inode);
-	inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
 	mark_inode_dirty(inode);
 out:
 	UFSD("EXIT: err %d\n", err);
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index a1559f7..eea9b7a 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -153,7 +153,7 @@ static int ufs_link (struct dentry * old_dentry, struct inode * dir,
 	struct inode *inode = d_inode(old_dentry);
 	int error;
 
-	inode->i_ctime = CURRENT_TIME_SEC;
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	inode_inc_link_count(inode);
 	ihold(inode);
 
@@ -279,7 +279,7 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		if (!new_de)
 			goto out_dir;
 		ufs_set_link(new_dir, new_de, new_page, old_inode, 1);
-		new_inode->i_ctime = CURRENT_TIME_SEC;
+		new_inode->i_ctime = current_fs_time(new_inode->i_sb);
 		if (dir_de)
 			drop_nlink(new_inode);
 		inode_dec_link_count(new_inode);
@@ -295,7 +295,7 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	 * Like most other Unix systems, set the ctime for inodes on a
  	 * rename.
 	 */
-	old_inode->i_ctime = CURRENT_TIME_SEC;
+	old_inode->i_ctime = current_fs_time(old_inode->i_sb);
 
 	ufs_delete_entry(old_dir, old_de, old_page);
 	mark_inode_dirty(old_inode);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
  2016-06-09  5:04 ` [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time() Deepa Dinamani
@ 2016-06-09  5:04 ` Deepa Dinamani
  2016-06-09 18:45   ` Linus Torvalds
  2016-06-09  5:04 ` [PATCH 03/21] fs: ubifs: " Deepa Dinamani
                   ` (18 subsequent siblings)
  20 siblings, 1 reply; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Theodore Ts'o, Andreas Dilger, linux-ext4

CURRENT_TIME_SEC and CURRENT_TIME are not y2038 safe.
current_fs_time() will be transitioned to be y2038 safe
along with vfs.

current_fs_time() returns timestamps according to the
granularities set in the super_block.
The granularity check to call current_fs_time() or
CURRENT_TIME_SEC is not required.
Use current_fs_time() to obtain timestamps
unconditionally.

Quota files are assumed to be on the same filesystem.
Hence, use current_fs_time() for these files as well.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: linux-ext4@vger.kernel.org
---
 fs/ext4/acl.c     |  2 +-
 fs/ext4/ext4.h    |  6 ------
 fs/ext4/extents.c | 10 +++++-----
 fs/ext4/ialloc.c  |  2 +-
 fs/ext4/inline.c  |  4 ++--
 fs/ext4/inode.c   |  6 +++---
 fs/ext4/ioctl.c   |  8 ++++----
 fs/ext4/namei.c   | 24 +++++++++++++-----------
 fs/ext4/super.c   |  2 +-
 fs/ext4/xattr.c   |  2 +-
 10 files changed, 31 insertions(+), 35 deletions(-)

diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c
index c6601a4..f9469cc 100644
--- a/fs/ext4/acl.c
+++ b/fs/ext4/acl.c
@@ -197,7 +197,7 @@ __ext4_set_acl(handle_t *handle, struct inode *inode, int type,
 			if (error < 0)
 				return error;
 			else {
-				inode->i_ctime = ext4_current_time(inode);
+				inode->i_ctime = current_fs_time(inode->i_sb);
 				ext4_mark_inode_dirty(handle, inode);
 				if (error == 0)
 					acl = NULL;
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index b84aa1c..14e5cf4 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1523,12 +1523,6 @@ static inline struct ext4_inode_info *EXT4_I(struct inode *inode)
 	return container_of(inode, struct ext4_inode_info, vfs_inode);
 }
 
-static inline struct timespec ext4_current_time(struct inode *inode)
-{
-	return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ?
-		current_fs_time(inode->i_sb) : CURRENT_TIME_SEC;
-}
-
 static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
 {
 	return ino == EXT4_ROOT_INO ||
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 2a2eef9..ac303be 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4722,7 +4722,7 @@ retry:
 		map.m_lblk += ret;
 		map.m_len = len = len - ret;
 		epos = (loff_t)map.m_lblk << inode->i_blkbits;
-		inode->i_ctime = ext4_current_time(inode);
+		inode->i_ctime = current_fs_time(inode->i_sb);
 		if (new_size) {
 			if (epos > new_size)
 				epos = new_size;
@@ -4850,7 +4850,7 @@ static long ext4_zero_range(struct file *file, loff_t offset,
 		}
 		/* Now release the pages and zero block aligned part of pages */
 		truncate_pagecache_range(inode, start, end - 1);
-		inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
+		inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
 
 		ret = ext4_alloc_file_blocks(file, lblk, max_blocks, new_size,
 					     flags, mode);
@@ -4875,7 +4875,7 @@ static long ext4_zero_range(struct file *file, loff_t offset,
 		goto out_dio;
 	}
 
-	inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
+	inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
 	if (new_size) {
 		ext4_update_inode_size(inode, new_size);
 	} else {
@@ -5574,7 +5574,7 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
 	up_write(&EXT4_I(inode)->i_data_sem);
 	if (IS_SYNC(inode))
 		ext4_handle_sync(handle);
-	inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
+	inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
 	ext4_mark_inode_dirty(handle, inode);
 
 out_stop:
@@ -5684,7 +5684,7 @@ int ext4_insert_range(struct inode *inode, loff_t offset, loff_t len)
 	/* Expand file to avoid data loss if there is error while shifting */
 	inode->i_size += len;
 	EXT4_I(inode)->i_disksize += len;
-	inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
+	inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
 	ret = ext4_mark_inode_dirty(handle, inode);
 	if (ret)
 		goto out_stop;
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 3da4cf8..152ef38 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -1039,7 +1039,7 @@ got:
 	/* This is the optimal IO size (for stat), not the fs block size */
 	inode->i_blocks = 0;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime =
-						       ext4_current_time(inode);
+						       current_fs_time(inode->i_sb);
 
 	memset(ei->i_data, 0, sizeof(ei->i_data));
 	ei->i_dir_start_lookup = 0;
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index ff7538c..67b3fe8 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -1028,7 +1028,7 @@ static int ext4_add_dirent_to_inline(handle_t *handle,
 	 * happen is that the times are slightly out of date
 	 * and/or different from the directory change time.
 	 */
-	dir->i_mtime = dir->i_ctime = ext4_current_time(dir);
+	dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
 	ext4_update_dx_flag(dir);
 	dir->i_version++;
 	ext4_mark_inode_dirty(handle, dir);
@@ -1971,7 +1971,7 @@ out:
 	if (inode->i_nlink)
 		ext4_orphan_del(handle, inode);
 
-	inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
+	inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
 	ext4_mark_inode_dirty(handle, inode);
 	if (IS_SYNC(inode))
 		ext4_handle_sync(handle);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index f7140ca..1546c02 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3991,7 +3991,7 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
 	if (IS_SYNC(inode))
 		ext4_handle_sync(handle);
 
-	inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
+	inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
 	ext4_mark_inode_dirty(handle, inode);
 out_stop:
 	ext4_journal_stop(handle);
@@ -4145,7 +4145,7 @@ out_stop:
 	if (inode->i_nlink)
 		ext4_orphan_del(handle, inode);
 
-	inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
+	inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
 	ext4_mark_inode_dirty(handle, inode);
 	ext4_journal_stop(handle);
 
@@ -5120,7 +5120,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
 			 * update c/mtime in shrink case below
 			 */
 			if (!shrink) {
-				inode->i_mtime = ext4_current_time(inode);
+				inode->i_mtime = current_fs_time(inode->i_sb);
 				inode->i_ctime = inode->i_mtime;
 			}
 			down_write(&EXT4_I(inode)->i_data_sem);
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 28cc412..fb429ac 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -155,7 +155,7 @@ static long swap_inode_boot_loader(struct super_block *sb,
 
 	swap_inode_data(inode, inode_bl);
 
-	inode->i_ctime = inode_bl->i_ctime = ext4_current_time(inode);
+	inode->i_ctime = inode_bl->i_ctime = current_fs_time(inode->i_sb);
 
 	spin_lock(&sbi->s_next_gen_lock);
 	inode->i_generation = sbi->s_next_generation++;
@@ -274,7 +274,7 @@ static int ext4_ioctl_setflags(struct inode *inode,
 	}
 
 	ext4_set_inode_flags(inode);
-	inode->i_ctime = ext4_current_time(inode);
+	inode->i_ctime = current_fs_time(inode->i_sb);
 
 	err = ext4_mark_iloc_dirty(handle, inode, &iloc);
 flags_err:
@@ -373,7 +373,7 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
 		}
 	}
 	EXT4_I(inode)->i_projid = kprojid;
-	inode->i_ctime = ext4_current_time(inode);
+	inode->i_ctime = current_fs_time(inode->i_sb);
 out_dirty:
 	rc = ext4_mark_iloc_dirty(handle, inode, &iloc);
 	if (!err)
@@ -505,7 +505,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		}
 		err = ext4_reserve_inode_write(handle, inode, &iloc);
 		if (err == 0) {
-			inode->i_ctime = ext4_current_time(inode);
+			inode->i_ctime = current_fs_time(inode->i_sb);
 			inode->i_generation = generation;
 			err = ext4_mark_iloc_dirty(handle, inode, &iloc);
 		}
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index ec4c399..c4cc01d 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1939,7 +1939,7 @@ static int add_dirent_to_buf(handle_t *handle, struct ext4_filename *fname,
 	 * happen is that the times are slightly out of date
 	 * and/or different from the directory change time.
 	 */
-	dir->i_mtime = dir->i_ctime = ext4_current_time(dir);
+	dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
 	ext4_update_dx_flag(dir);
 	dir->i_version++;
 	ext4_mark_inode_dirty(handle, dir);
@@ -2988,7 +2988,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
 	 * recovery. */
 	inode->i_size = 0;
 	ext4_orphan_add(handle, inode);
-	inode->i_ctime = dir->i_ctime = dir->i_mtime = ext4_current_time(inode);
+	inode->i_ctime = dir->i_ctime = dir->i_mtime = current_fs_time(inode->i_sb);
 	ext4_mark_inode_dirty(handle, inode);
 	ext4_dec_count(handle, dir);
 	ext4_update_dx_flag(dir);
@@ -3051,13 +3051,13 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
 	retval = ext4_delete_entry(handle, dir, de, bh);
 	if (retval)
 		goto end_unlink;
-	dir->i_ctime = dir->i_mtime = ext4_current_time(dir);
+	dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
 	ext4_update_dx_flag(dir);
 	ext4_mark_inode_dirty(handle, dir);
 	drop_nlink(inode);
 	if (!inode->i_nlink)
 		ext4_orphan_add(handle, inode);
-	inode->i_ctime = ext4_current_time(inode);
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	ext4_mark_inode_dirty(handle, inode);
 
 end_unlink:
@@ -3256,7 +3256,7 @@ retry:
 	if (IS_DIRSYNC(dir))
 		ext4_handle_sync(handle);
 
-	inode->i_ctime = ext4_current_time(inode);
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	ext4_inc_count(handle, inode);
 	ihold(inode);
 
@@ -3383,7 +3383,7 @@ static int ext4_setent(handle_t *handle, struct ext4_renament *ent,
 		ent->de->file_type = file_type;
 	ent->dir->i_version++;
 	ent->dir->i_ctime = ent->dir->i_mtime =
-		ext4_current_time(ent->dir);
+		current_fs_time(ent->dir->i_sb);
 	ext4_mark_inode_dirty(handle, ent->dir);
 	BUFFER_TRACE(ent->bh, "call ext4_handle_dirty_metadata");
 	if (!ent->inlined) {
@@ -3654,7 +3654,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
 	 * Like most other Unix systems, set the ctime for inodes on a
 	 * rename.
 	 */
-	old.inode->i_ctime = ext4_current_time(old.inode);
+	old.inode->i_ctime = current_fs_time(old.inode->i_sb);
 	ext4_mark_inode_dirty(handle, old.inode);
 
 	if (!whiteout) {
@@ -3666,9 +3666,9 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
 
 	if (new.inode) {
 		ext4_dec_count(handle, new.inode);
-		new.inode->i_ctime = ext4_current_time(new.inode);
+		new.inode->i_ctime = current_fs_time(new.inode->i_sb);
 	}
-	old.dir->i_ctime = old.dir->i_mtime = ext4_current_time(old.dir);
+	old.dir->i_ctime = old.dir->i_mtime = current_fs_time(old.dir->i_sb);
 	ext4_update_dx_flag(old.dir);
 	if (old.dir_bh) {
 		retval = ext4_rename_dir_finish(handle, &old, new.dir->i_ino);
@@ -3726,6 +3726,7 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
 	};
 	u8 new_file_type;
 	int retval;
+	struct timespec ctime;
 
 	if ((ext4_encrypted_inode(old_dir) ||
 	     ext4_encrypted_inode(new_dir)) &&
@@ -3828,8 +3829,9 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
 	 * Like most other Unix systems, set the ctime for inodes on a
 	 * rename.
 	 */
-	old.inode->i_ctime = ext4_current_time(old.inode);
-	new.inode->i_ctime = ext4_current_time(new.inode);
+	ctime = current_fs_time(old.inode->i_sb);
+	old.inode->i_ctime = ctime;
+	new.inode->i_ctime = ctime;
 	ext4_mark_inode_dirty(handle, old.inode);
 	ext4_mark_inode_dirty(handle, new.inode);
 
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3822a5a..c39cb7c 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5165,7 +5165,7 @@ static int ext4_quota_off(struct super_block *sb, int type)
 	handle = ext4_journal_start(inode, EXT4_HT_QUOTA, 1);
 	if (IS_ERR(handle))
 		goto out;
-	inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+	inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
 	ext4_mark_inode_dirty(handle, inode);
 	ext4_journal_stop(handle);
 
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index e79bd32..808609c 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1253,7 +1253,7 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
 	}
 	if (!error) {
 		ext4_xattr_update_super_block(handle, inode->i_sb);
-		inode->i_ctime = ext4_current_time(inode);
+		inode->i_ctime = current_fs_time(inode->i_sb);
 		if (!value)
 			ext4_clear_inode_state(inode, EXT4_STATE_NO_EXPAND);
 		error = ext4_mark_iloc_dirty(handle, inode, &is.iloc);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 03/21] fs: ubifs: Use current_fs_time() for inode timestamps
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
  2016-06-09  5:04 ` [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time() Deepa Dinamani
  2016-06-09  5:04 ` [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps Deepa Dinamani
@ 2016-06-09  5:04 ` Deepa Dinamani
  2016-06-09  5:04 ` [PATCH 05/21] fs: jfs: Replace CURRENT_TIME_SEC by current_fs_time() Deepa Dinamani
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Artem Bityutskiy, Adrian Hunter, linux-mtd

CURRENT_TIME_SEC is not y2038 safe. current_fs_time() will
be transitioned to use 64 bit time along with vfs in a
separate patch.
There is no plan to transition CURRENT_TIME_SEC to use
y2038 safe time interfaces.

current_fs_time() returns timestamps according to the
granularities set in the super_block.
The granularity check to call current_fs_time() or
CURRENT_TIME_SEC is not required.
Use current_fs_time() to obtain timestamps
unconditionally.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: linux-mtd@lists.infradead.org
---
 fs/ubifs/dir.c   | 10 +++++-----
 fs/ubifs/file.c  | 12 ++++++------
 fs/ubifs/ioctl.c |  2 +-
 fs/ubifs/misc.h  | 10 ----------
 fs/ubifs/sb.c    | 18 ++++++++++++++----
 fs/ubifs/xattr.c |  6 +++---
 6 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 4b86d3a..2dede0f 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -106,7 +106,7 @@ struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir,
 
 	inode_init_owner(inode, dir, mode);
 	inode->i_mtime = inode->i_atime = inode->i_ctime =
-			 ubifs_current_time(inode);
+			 current_fs_time(inode->i_sb);
 	inode->i_mapping->nrpages = 0;
 
 	switch (mode & S_IFMT) {
@@ -529,7 +529,7 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
 	lock_2_inodes(dir, inode);
 	inc_nlink(inode);
 	ihold(inode);
-	inode->i_ctime = ubifs_current_time(inode);
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	dir->i_size += sz_change;
 	dir_ui->ui_size = dir->i_size;
 	dir->i_mtime = dir->i_ctime = inode->i_ctime;
@@ -586,7 +586,7 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
 	}
 
 	lock_2_inodes(dir, inode);
-	inode->i_ctime = ubifs_current_time(dir);
+	inode->i_ctime = current_fs_time(dir->i_sb);
 	drop_nlink(inode);
 	dir->i_size -= sz_change;
 	dir_ui->ui_size = dir->i_size;
@@ -675,7 +675,7 @@ static int ubifs_rmdir(struct inode *dir, struct dentry *dentry)
 	}
 
 	lock_2_inodes(dir, inode);
-	inode->i_ctime = ubifs_current_time(dir);
+	inode->i_ctime = current_fs_time(dir->i_sb);
 	clear_nlink(inode);
 	drop_nlink(dir);
 	dir->i_size -= sz_change;
@@ -1023,7 +1023,7 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	 * Like most other Unix systems, set the @i_ctime for inodes on a
 	 * rename.
 	 */
-	time = ubifs_current_time(old_dir);
+	time = current_fs_time(old_dir->i_sb);
 	old_inode->i_ctime = time;
 
 	/* We must adjust parent link count when renaming directories */
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 0831697..01c46e0 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1181,7 +1181,7 @@ static int do_truncation(struct ubifs_info *c, struct inode *inode,
 	mutex_lock(&ui->ui_mutex);
 	ui->ui_size = inode->i_size;
 	/* Truncation changes inode [mc]time */
-	inode->i_mtime = inode->i_ctime = ubifs_current_time(inode);
+	inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
 	/* Other attributes may be changed at the same time as well */
 	do_attr_changes(inode, attr);
 	err = ubifs_jnl_truncate(c, inode, old_size, new_size);
@@ -1228,7 +1228,7 @@ static int do_setattr(struct ubifs_info *c, struct inode *inode,
 	mutex_lock(&ui->ui_mutex);
 	if (attr->ia_valid & ATTR_SIZE) {
 		/* Truncation changes inode [mc]time */
-		inode->i_mtime = inode->i_ctime = ubifs_current_time(inode);
+		inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
 		/* 'truncate_setsize()' changed @i_size, update @ui_size */
 		ui->ui_size = inode->i_size;
 	}
@@ -1405,7 +1405,7 @@ int ubifs_update_time(struct inode *inode, struct timespec *time,
  */
 static int update_mctime(struct inode *inode)
 {
-	struct timespec now = ubifs_current_time(inode);
+	struct timespec now = current_fs_time(inode->i_sb);
 	struct ubifs_inode *ui = ubifs_inode(inode);
 	struct ubifs_info *c = inode->i_sb->s_fs_info;
 
@@ -1419,7 +1419,7 @@ static int update_mctime(struct inode *inode)
 			return err;
 
 		mutex_lock(&ui->ui_mutex);
-		inode->i_mtime = inode->i_ctime = ubifs_current_time(inode);
+		inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
 		release = ui->dirty;
 		mark_inode_dirty_sync(inode);
 		mutex_unlock(&ui->ui_mutex);
@@ -1477,7 +1477,7 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma,
 	struct page *page = vmf->page;
 	struct inode *inode = file_inode(vma->vm_file);
 	struct ubifs_info *c = inode->i_sb->s_fs_info;
-	struct timespec now = ubifs_current_time(inode);
+	struct timespec now = current_fs_time(inode->i_sb);
 	struct ubifs_budget_req req = { .new_page = 1 };
 	int err, update_time;
 
@@ -1545,7 +1545,7 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma,
 		struct ubifs_inode *ui = ubifs_inode(inode);
 
 		mutex_lock(&ui->ui_mutex);
-		inode->i_mtime = inode->i_ctime = ubifs_current_time(inode);
+		inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
 		release = ui->dirty;
 		mark_inode_dirty_sync(inode);
 		mutex_unlock(&ui->ui_mutex);
diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c
index 3c7b29d..127b2ae 100644
--- a/fs/ubifs/ioctl.c
+++ b/fs/ubifs/ioctl.c
@@ -126,7 +126,7 @@ static int setflags(struct inode *inode, int flags)
 
 	ui->flags = ioctl2ubifs(flags);
 	ubifs_set_inode_flags(inode);
-	inode->i_ctime = ubifs_current_time(inode);
+	inode->i_ctime = current_fs_time(inode->i_sb);
 	release = ui->dirty;
 	mark_inode_dirty_sync(inode);
 	mutex_unlock(&ui->ui_mutex);
diff --git a/fs/ubifs/misc.h b/fs/ubifs/misc.h
index 8ece6ca..caf83d6 100644
--- a/fs/ubifs/misc.h
+++ b/fs/ubifs/misc.h
@@ -225,16 +225,6 @@ static inline void *ubifs_idx_key(const struct ubifs_info *c,
 }
 
 /**
- * ubifs_current_time - round current time to time granularity.
- * @inode: inode
- */
-static inline struct timespec ubifs_current_time(struct inode *inode)
-{
-	return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ?
-		current_fs_time(inode->i_sb) : CURRENT_TIME_SEC;
-}
-
-/**
  * ubifs_tnc_lookup - look up a file-system node.
  * @c: UBIFS file-system description object
  * @key: node key to lookup
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index 3cbb904..f4f73d2 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -84,6 +84,8 @@ static int create_default_filesystem(struct ubifs_info *c)
 	int min_leb_cnt = UBIFS_MIN_LEB_CNT;
 	long long tmp64, main_bytes;
 	__le64 tmp_le64;
+	__le32 tmp_le32;
+	struct timespec ts;
 
 	/* Some functions called from here depend on the @c->key_len filed */
 	c->key_len = UBIFS_SK_LEN;
@@ -297,13 +299,21 @@ static int create_default_filesystem(struct ubifs_info *c)
 	ino->ch.node_type = UBIFS_INO_NODE;
 	ino->creat_sqnum = cpu_to_le64(++c->max_sqnum);
 	ino->nlink = cpu_to_le32(2);
-	tmp_le64 = cpu_to_le64(CURRENT_TIME_SEC.tv_sec);
+
+	/* Initialize the super_block properties needed by
+	 * current_fs_time().
+	 */
+	c->vfs_sb->s_time_gran = DEFAULT_TIME_GRAN;
+
+	ts = current_fs_time(c->vfs_sb);
+	tmp_le64 = cpu_to_le64(ts.tv_sec);
 	ino->atime_sec   = tmp_le64;
 	ino->ctime_sec   = tmp_le64;
 	ino->mtime_sec   = tmp_le64;
-	ino->atime_nsec  = 0;
-	ino->ctime_nsec  = 0;
-	ino->mtime_nsec  = 0;
+	tmp_le32 = cpu_to_le32(ts.tv_nsec);
+	ino->atime_nsec  = tmp_le32;
+	ino->ctime_nsec  = tmp_le32;
+	ino->mtime_nsec  = tmp_le32;
 	ino->mode = cpu_to_le32(S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO);
 	ino->size = cpu_to_le64(UBIFS_INO_NODE_SZ);
 
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index b5fc279..76a3c49 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -152,7 +152,7 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
 	ui->data_len = size;
 
 	mutex_lock(&host_ui->ui_mutex);
-	host->i_ctime = ubifs_current_time(host);
+	host->i_ctime = current_fs_time(host->i_sb);
 	host_ui->xattr_cnt += 1;
 	host_ui->xattr_size += CALC_DENT_SIZE(nm->len);
 	host_ui->xattr_size += CALC_XATTR_BYTES(size);
@@ -221,7 +221,7 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
 	mutex_unlock(&ui->ui_mutex);
 
 	mutex_lock(&host_ui->ui_mutex);
-	host->i_ctime = ubifs_current_time(host);
+	host->i_ctime = current_fs_time(host->i_sb);
 	host_ui->xattr_size -= CALC_XATTR_BYTES(ui->data_len);
 	host_ui->xattr_size += CALC_XATTR_BYTES(size);
 
@@ -458,7 +458,7 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
 		return err;
 
 	mutex_lock(&host_ui->ui_mutex);
-	host->i_ctime = ubifs_current_time(host);
+	host->i_ctime = current_fs_time(host->i_sb);
 	host_ui->xattr_cnt -= 1;
 	host_ui->xattr_size -= CALC_DENT_SIZE(nm->len);
 	host_ui->xattr_size -= CALC_XATTR_BYTES(ui->data_len);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 05/21] fs: jfs: Replace CURRENT_TIME_SEC by current_fs_time()
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (2 preceding siblings ...)
  2016-06-09  5:04 ` [PATCH 03/21] fs: ubifs: " Deepa Dinamani
@ 2016-06-09  5:04 ` Deepa Dinamani
  2016-06-09  5:04 ` [PATCH 06/21] fs: udf: Replace CURRENT_TIME with current_fs_time() Deepa Dinamani
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Dave Kleikamp, jfs-discussion

jfs uses nanosecond granularity for filesystem timestamps.
Only this assignemt is not using nanosecond granularity.
Use current_fs_time() to get the right nanosecond granularity.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Dave Kleikamp <shaggy@kernel.org>
Cc: jfs-discussion@lists.sourceforge.net
---
 fs/jfs/ioctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c
index 8653cac..b52aedf 100644
--- a/fs/jfs/ioctl.c
+++ b/fs/jfs/ioctl.c
@@ -60,6 +60,7 @@ long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
 	struct inode *inode = file_inode(filp);
 	struct jfs_inode_info *jfs_inode = JFS_IP(inode);
+	struct super_block *sb = inode->i_sb;
 	unsigned int flags;
 
 	switch (cmd) {
@@ -121,7 +122,7 @@ long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 
 		jfs_set_inode_flags(inode);
 		inode_unlock(inode);
-		inode->i_ctime = CURRENT_TIME_SEC;
+		inode->i_ctime = current_fs_time(sb);
 		mark_inode_dirty(inode);
 setflags_out:
 		mnt_drop_write_file(filp);
@@ -130,7 +131,6 @@ setflags_out:
 
 	case FITRIM:
 	{
-		struct super_block *sb = inode->i_sb;
 		struct request_queue *q = bdev_get_queue(sb->s_bdev);
 		struct fstrim_range range;
 		s64 ret = 0;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 06/21] fs: udf: Replace CURRENT_TIME with current_fs_time()
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (3 preceding siblings ...)
  2016-06-09  5:04 ` [PATCH 05/21] fs: jfs: Replace CURRENT_TIME_SEC by current_fs_time() Deepa Dinamani
@ 2016-06-09  5:04 ` Deepa Dinamani
  2016-06-09  7:41   ` Jan Kara
  2016-06-09  5:04 ` [PATCH 07/21] fs: cifs: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani
                   ` (15 subsequent siblings)
  20 siblings, 1 reply; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038, Jan Kara

CURRENT_TIME is not y2038 safe.

CURRENT_TIME macro is also not appropriate for filesystems
as it doesn't use the right granularity for filesystem
timestamps.

Logical Volume Integrity format is described to have the
same timestamp format for "Recording Date and time" as
the other [a,c,m]timestamps.
Hence using current_fs_time() instead here promises to
maintain the same granularity as other timestamps.

This is also in preparation for the patch that transitions
vfs timestamps to use 64 bit time and hence make them
y2038 safe. As part of the effort current_fs_time() will be
extended to do range checks.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Jan Kara <jack@suse.com>
---
 fs/udf/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/udf/super.c b/fs/udf/super.c
index 4942549..482a610 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1998,7 +1998,7 @@ static void udf_open_lvid(struct super_block *sb)
 	lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
 	lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
 	udf_time_to_disk_stamp(&lvid->recordingDateAndTime,
-				CURRENT_TIME);
+				current_fs_time(sb));
 	lvid->integrityType = cpu_to_le32(LVID_INTEGRITY_TYPE_OPEN);
 
 	lvid->descTag.descCRC = cpu_to_le16(
@@ -2030,7 +2030,7 @@ static void udf_close_lvid(struct super_block *sb)
 	mutex_lock(&sbi->s_alloc_mutex);
 	lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
 	lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
-	udf_time_to_disk_stamp(&lvid->recordingDateAndTime, CURRENT_TIME);
+	udf_time_to_disk_stamp(&lvid->recordingDateAndTime, current_fs_time(sb));
 	if (UDF_MAX_WRITE_VERSION > le16_to_cpu(lvidiu->maxUDFWriteRev))
 		lvidiu->maxUDFWriteRev = cpu_to_le16(UDF_MAX_WRITE_VERSION);
 	if (sbi->s_udfrev > le16_to_cpu(lvidiu->minUDFReadRev))
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 07/21] fs: cifs: Replace CURRENT_TIME by current_fs_time()
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (4 preceding siblings ...)
  2016-06-09  5:04 ` [PATCH 06/21] fs: udf: Replace CURRENT_TIME with current_fs_time() Deepa Dinamani
@ 2016-06-09  5:04 ` Deepa Dinamani
  2016-06-09  5:04 ` [PATCH 08/21] fs: cifs: Replace CURRENT_TIME with ktime_get_real_ts() Deepa Dinamani
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Steve French, linux-cifs, samba-technical

CURRENT_TIME macro is not appropriate for filesystems as it
doesn't use the right granularity for filesystem timestamps.
Use current_fs_time() instead.

This is also in preparation for the patch that transitions
vfs timestamps to use 64 bit time and hence make them
y2038 safe.

CURRENT_TIME macro will be deleted before merging the
aforementioned change.

Change signature of helper cifs_all_info_to_fattr since it
now needs both super_block and cifs_sb_info.

Note: The inode timestamps read from the server are assumed
to have correct granularity and range.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Steve French <sfrench@samba.org>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
---
 fs/cifs/inode.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 514dadb..692c98b 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -320,9 +320,8 @@ cifs_create_dfs_fattr(struct cifs_fattr *fattr, struct super_block *sb)
 	fattr->cf_mode = S_IFDIR | S_IXUGO | S_IRWXU;
 	fattr->cf_uid = cifs_sb->mnt_uid;
 	fattr->cf_gid = cifs_sb->mnt_gid;
-	fattr->cf_atime = CURRENT_TIME;
-	fattr->cf_ctime = CURRENT_TIME;
-	fattr->cf_mtime = CURRENT_TIME;
+	fattr->cf_atime = fattr->cf_ctime =
+		fattr->cf_mtime = current_fs_time(sb);
 	fattr->cf_nlink = 2;
 	fattr->cf_flags |= CIFS_FATTR_DFS_REFERRAL;
 }
@@ -584,9 +583,10 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path,
 /* Fill a cifs_fattr struct with info from FILE_ALL_INFO */
 static void
 cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
-		       struct cifs_sb_info *cifs_sb, bool adjust_tz,
+		       struct super_block *sb, bool adjust_tz,
 		       bool symlink)
 {
+	struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
 	struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
 
 	memset(fattr, 0, sizeof(*fattr));
@@ -597,7 +597,7 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
 	if (info->LastAccessTime)
 		fattr->cf_atime = cifs_NTtimeToUnix(info->LastAccessTime);
 	else
-		fattr->cf_atime = CURRENT_TIME;
+		fattr->cf_atime = current_fs_time(sb);
 
 	fattr->cf_ctime = cifs_NTtimeToUnix(info->ChangeTime);
 	fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime);
@@ -657,7 +657,6 @@ cifs_get_file_info(struct file *filp)
 	FILE_ALL_INFO find_data;
 	struct cifs_fattr fattr;
 	struct inode *inode = file_inode(filp);
-	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
 	struct cifsFileInfo *cfile = filp->private_data;
 	struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
 	struct TCP_Server_Info *server = tcon->ses->server;
@@ -669,7 +668,7 @@ cifs_get_file_info(struct file *filp)
 	rc = server->ops->query_file_info(xid, tcon, &cfile->fid, &find_data);
 	switch (rc) {
 	case 0:
-		cifs_all_info_to_fattr(&fattr, &find_data, cifs_sb, false,
+		cifs_all_info_to_fattr(&fattr, &find_data, inode->i_sb, false,
 				       false);
 		break;
 	case -EREMOTE:
@@ -751,7 +750,7 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
 	}
 
 	if (!rc) {
-		cifs_all_info_to_fattr(&fattr, data, cifs_sb, adjust_tz,
+		cifs_all_info_to_fattr(&fattr, data, sb, adjust_tz,
 				       symlink);
 	} else if (rc == -EREMOTE) {
 		cifs_create_dfs_fattr(&fattr, sb);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 08/21] fs: cifs: Replace CURRENT_TIME with ktime_get_real_ts()
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (5 preceding siblings ...)
  2016-06-09  5:04 ` [PATCH 07/21] fs: cifs: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani
@ 2016-06-09  5:04 ` Deepa Dinamani
  2016-06-09  5:04 ` [PATCH 09/21] fs: cifs: Replace CURRENT_TIME by get_seconds Deepa Dinamani
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Steve French, linux-cifs, samba-technical

This is in preparation for the patch that transitions
vfs timestamps to use 64 bit time and hence make them
y2038 safe.

CURRENT_TIME macro will be deleted before merging the
aforementioned patch.

Filesystem times will use current_fs_time() instead of
CURRENT_TIME.
Use ktime_get_real_ts() here as this is not filesystem time.
ktime_get_real_ts() returns the timestamp in ns which can
be used to calculate network time for NTLMv2 authentication
timestamp.

All cifs timestamps currently use timespec internally.
This timestamp can also be transitioned into using
timespec64 when all other timestamps for cifs is transitioned
to use timespec64.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Steve French <sfrench@samba.org>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
---
 fs/cifs/cifsencrypt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 6aeb8d4..b86ce67 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -471,6 +471,7 @@ find_timestamp(struct cifs_ses *ses)
 	unsigned char *blobptr;
 	unsigned char *blobend;
 	struct ntlmssp2_name *attrptr;
+	struct timespec ts;
 
 	if (!ses->auth_key.len || !ses->auth_key.response)
 		return 0;
@@ -495,7 +496,8 @@ find_timestamp(struct cifs_ses *ses)
 		blobptr += attrsize; /* advance attr value */
 	}
 
-	return cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME));
+	ktime_get_real_ts(&ts);
+	return cpu_to_le64(cifs_UnixTimeToNT(ts));
 }
 
 static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 09/21] fs: cifs: Replace CURRENT_TIME by get_seconds
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (6 preceding siblings ...)
  2016-06-09  5:04 ` [PATCH 08/21] fs: cifs: Replace CURRENT_TIME with ktime_get_real_ts() Deepa Dinamani
@ 2016-06-09  5:04 ` Deepa Dinamani
  2016-06-09  5:04 ` [PATCH 10/21] fs: f2fs: Use ktime_get_real_seconds for sit_info times Deepa Dinamani
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Steve French, linux-cifs, samba-technical

This is in preparation for the change that transitions
filesystem timestamps to use 64 bit time and hence make
them y2038 safe.

CURRENT_TIME macro will be deleted before merging the
aforementioned patch.

Filesystems will use current_fs_time() instead of
CURRENT_TIME.
Use get_seconds() here as this is not filesystem time.
Only the seconds portion of the timestamp is necessary for
timezone calculation using server time.

Assume that the difference between server and client times
lie in the range INT_MIN..INT_MAX. This is valid because
this is the difference between current times between server
and client, and the largest timezone difference is in the
range of one day.

All cifs timestamps currently use timespec internally.
This timestamp can also be transitioned into using
timespec64 when all other timestamps for cifs is transitioned
to use timespec64.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Steve French <sfrench@samba.org>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
---
 fs/cifs/cifssmb.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index d47197e..aeae6a0 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -478,14 +478,14 @@ decode_lanman_negprot_rsp(struct TCP_Server_Info *server, NEGOTIATE_RSP *pSMBr)
 		 * this requirement.
 		 */
 		int val, seconds, remain, result;
-		struct timespec ts, utc;
-		utc = CURRENT_TIME;
+		struct timespec ts;
+		unsigned long utc = get_seconds();
 		ts = cnvrtDosUnixTm(rsp->SrvTime.Date,
 				    rsp->SrvTime.Time, 0);
 		cifs_dbg(FYI, "SrvTime %d sec since 1970 (utc: %d) diff: %d\n",
-			 (int)ts.tv_sec, (int)utc.tv_sec,
-			 (int)(utc.tv_sec - ts.tv_sec));
-		val = (int)(utc.tv_sec - ts.tv_sec);
+			 (int)ts.tv_sec, (int)utc,
+			 (int)(utc - ts.tv_sec));
+		val = (int)(utc - ts.tv_sec);
 		seconds = abs(val);
 		result = (seconds / MIN_TZ_ADJ) * MIN_TZ_ADJ;
 		remain = seconds % MIN_TZ_ADJ;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 10/21] fs: f2fs: Use ktime_get_real_seconds for sit_info times
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (7 preceding siblings ...)
  2016-06-09  5:04 ` [PATCH 09/21] fs: cifs: Replace CURRENT_TIME by get_seconds Deepa Dinamani
@ 2016-06-09  5:04 ` Deepa Dinamani
  2016-06-09  5:04 ` [PATCH 11/21] drivers: staging: lustre: Replace CURRENT_TIME with current_fs_time() Deepa Dinamani
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Jaegeuk Kim, Changman Lee, Chao Yu, linux-f2fs-devel

CURRENT_TIME_SEC is not y2038 safe.

Replace use of CURRENT_TIME_SEC with ktime_get_real_seconds
in segment timestamps used by GC algorithm including the
segment mtime timestamps.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Changman Lee <cm224.lee@samsung.com>
Cc: Chao Yu <chao2.yu@samsung.com>
Cc: linux-f2fs-devel@lists.sourceforge.net
---
 fs/f2fs/segment.c | 2 +-
 fs/f2fs/segment.h | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 2e6f537..bde5dbd 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2123,7 +2123,7 @@ static int build_sit_info(struct f2fs_sb_info *sbi)
 	sit_i->dirty_sentries = 0;
 	sit_i->sents_per_block = SIT_ENTRY_PER_BLOCK;
 	sit_i->elapsed_time = le64_to_cpu(sbi->ckpt->elapsed_time);
-	sit_i->mounted_time = CURRENT_TIME_SEC.tv_sec;
+	sit_i->mounted_time = ktime_get_real_seconds();
 	mutex_init(&sit_i->sentry_lock);
 	return 0;
 }
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 7a756ff..da3e87f 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -652,8 +652,9 @@ static inline void set_to_next_sit(struct sit_info *sit_i, unsigned int start)
 static inline unsigned long long get_mtime(struct f2fs_sb_info *sbi)
 {
 	struct sit_info *sit_i = SIT_I(sbi);
-	return sit_i->elapsed_time + CURRENT_TIME_SEC.tv_sec -
-						sit_i->mounted_time;
+	time64_t now = ktime_get_real_seconds();
+
+	return sit_i->elapsed_time + now - sit_i->mounted_time;
 }
 
 static inline void set_summary(struct f2fs_summary *sum, nid_t nid,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 11/21] drivers: staging: lustre: Replace CURRENT_TIME with current_fs_time()
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (8 preceding siblings ...)
  2016-06-09  5:04 ` [PATCH 10/21] fs: f2fs: Use ktime_get_real_seconds for sit_info times Deepa Dinamani
@ 2016-06-09  5:04 ` Deepa Dinamani
  2016-06-11  0:36   ` [lustre-devel] " James Simmons
  2016-06-09  5:04 ` [PATCH 12/21] block: rbd: Replace non inode " Deepa Dinamani
                   ` (10 subsequent siblings)
  20 siblings, 1 reply; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Greg Kroah-Hartman, lustre-devel

CURRENT_TIME macro is not appropriate for filesystems as it
doesn't use the right granularity for filesystem timestamps.
Use current_fs_time() instead.

This is also in preparation for the patch that transitions
vfs timestamps to use 64 bit time and hence make them
y2038 safe. As part of the effort current_fs_time() will be
extended to do range checks. Hence, it is necessary for all
file system timestamps to use current_fs_time().

Also change format string for prints so that these are valid
when vfs is transitioned to use 64 bit timestamps.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: lustre-devel@lists.lustre.org
---
 drivers/staging/lustre/lustre/llite/llite_lib.c         | 17 +++++++++--------
 drivers/staging/lustre/lustre/llite/namei.c             |  4 ++--
 drivers/staging/lustre/lustre/mdc/mdc_reint.c           |  6 +++---
 .../staging/lustre/lustre/obdclass/linux/linux-obdo.c   |  6 +++---
 drivers/staging/lustre/lustre/obdclass/obdo.c           |  6 +++---
 drivers/staging/lustre/lustre/osc/osc_io.c              |  2 +-
 6 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 96c7e9f..919748f 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1219,6 +1219,7 @@ static int ll_setattr_done_writing(struct inode *inode,
 int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
 {
 	struct inode *inode = d_inode(dentry);
+	struct super_block *sb = inode->i_sb;
 	struct ll_inode_info *lli = ll_i2info(inode);
 	struct md_op_data *op_data = NULL;
 	struct md_open_data *mod = NULL;
@@ -1258,23 +1259,23 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
 
 	/* We mark all of the fields "set" so MDS/OST does not re-set them */
 	if (attr->ia_valid & ATTR_CTIME) {
-		attr->ia_ctime = CURRENT_TIME;
+		attr->ia_ctime = current_fs_time(sb);
 		attr->ia_valid |= ATTR_CTIME_SET;
 	}
 	if (!(attr->ia_valid & ATTR_ATIME_SET) &&
 	    (attr->ia_valid & ATTR_ATIME)) {
-		attr->ia_atime = CURRENT_TIME;
+		attr->ia_atime = current_fs_time(sb);
 		attr->ia_valid |= ATTR_ATIME_SET;
 	}
 	if (!(attr->ia_valid & ATTR_MTIME_SET) &&
 	    (attr->ia_valid & ATTR_MTIME)) {
-		attr->ia_mtime = CURRENT_TIME;
+		attr->ia_mtime = current_fs_time(sb);
 		attr->ia_valid |= ATTR_MTIME_SET;
 	}
 
 	if (attr->ia_valid & (ATTR_MTIME | ATTR_CTIME))
-		CDEBUG(D_INODE, "setting mtime %lu, ctime %lu, now = %llu\n",
-		       LTIME_S(attr->ia_mtime), LTIME_S(attr->ia_ctime),
+		CDEBUG(D_INODE, "setting mtime %llu, ctime %llu, now = %llu\n",
+		       (long long)LTIME_S(attr->ia_mtime), (long long)LTIME_S(attr->ia_ctime),
 		       (s64)ktime_get_real_seconds());
 
 	/* We always do an MDS RPC, even if we're only changing the size;
@@ -1564,9 +1565,9 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
 	}
 	if (body->valid & OBD_MD_FLMTIME) {
 		if (body->mtime > LTIME_S(inode->i_mtime)) {
-			CDEBUG(D_INODE, "setting ino %lu mtime from %lu to %llu\n",
-			       inode->i_ino, LTIME_S(inode->i_mtime),
-			       body->mtime);
+			CDEBUG(D_INODE, "setting ino %lu mtime from %llu to %llu\n",
+			       inode->i_ino, (unsigned long long)LTIME_S(inode->i_mtime),
+			       (unsigned long long)body->mtime);
 			LTIME_S(inode->i_mtime) = body->mtime;
 		}
 		lli->lli_mtime = body->mtime;
diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c
index 5eba0eb..48ed1ce 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -731,8 +731,8 @@ static void ll_update_times(struct ptlrpc_request *request,
 	LASSERT(body);
 	if (body->valid & OBD_MD_FLMTIME &&
 	    body->mtime > LTIME_S(inode->i_mtime)) {
-		CDEBUG(D_INODE, "setting fid "DFID" mtime from %lu to %llu\n",
-		       PFID(ll_inode2fid(inode)), LTIME_S(inode->i_mtime),
+		CDEBUG(D_INODE, "setting fid "DFID" mtime from %llu to %llu\n",
+		       PFID(ll_inode2fid(inode)), (unsigned long long)LTIME_S(inode->i_mtime),
 		       body->mtime);
 		LTIME_S(inode->i_mtime) = body->mtime;
 	}
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_reint.c b/drivers/staging/lustre/lustre/mdc/mdc_reint.c
index 4ef3db1..9980f3a 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_reint.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_reint.c
@@ -143,9 +143,9 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
 	rpc_lock = obd->u.cli.cl_rpc_lock;
 
 	if (op_data->op_attr.ia_valid & (ATTR_MTIME | ATTR_CTIME))
-		CDEBUG(D_INODE, "setting mtime %ld, ctime %ld\n",
-		       LTIME_S(op_data->op_attr.ia_mtime),
-		       LTIME_S(op_data->op_attr.ia_ctime));
+		CDEBUG(D_INODE, "setting mtime %lld, ctime %lld\n",
+		       (long long)LTIME_S(op_data->op_attr.ia_mtime),
+		       (long long)LTIME_S(op_data->op_attr.ia_ctime));
 	mdc_setattr_pack(req, op_data, ea, ealen, ea2, ea2len);
 
 	ptlrpc_request_set_replen(req);
diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
index b41b65e..ccd2b7b 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
@@ -54,9 +54,9 @@ void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid)
 
 	if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
 		CDEBUG(D_INODE,
-		       "valid %#llx, cur time %lu/%lu, new %llu/%llu\n",
-		       src->o_valid, LTIME_S(dst->i_mtime),
-		       LTIME_S(dst->i_ctime), src->o_mtime, src->o_ctime);
+		       "valid %#llx, cur time %llu/%llu, new %llu/%llu\n",
+		       src->o_valid, (unsigned long long)LTIME_S(dst->i_mtime),
+		       (unsigned long long)LTIME_S(dst->i_ctime), src->o_mtime, src->o_ctime);
 
 	if (valid & OBD_MD_FLATIME && src->o_atime > LTIME_S(dst->i_atime))
 		LTIME_S(dst->i_atime) = src->o_atime;
diff --git a/drivers/staging/lustre/lustre/obdclass/obdo.c b/drivers/staging/lustre/lustre/obdclass/obdo.c
index 748e33f..973fa4c 100644
--- a/drivers/staging/lustre/lustre/obdclass/obdo.c
+++ b/drivers/staging/lustre/lustre/obdclass/obdo.c
@@ -62,9 +62,9 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid)
 	u32 newvalid = 0;
 
 	if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
-		CDEBUG(D_INODE, "valid %x, new time %lu/%lu\n",
-		       valid, LTIME_S(src->i_mtime),
-		       LTIME_S(src->i_ctime));
+		CDEBUG(D_INODE, "valid %x, new time %llu/%llu\n",
+		       valid, (unsigned long long)LTIME_S(src->i_mtime),
+		       (unsigned long long)LTIME_S(src->i_ctime));
 
 	if (valid & OBD_MD_FLATIME) {
 		dst->o_atime = LTIME_S(src->i_atime);
diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c
index d534b0e..99f69bb 100644
--- a/drivers/staging/lustre/lustre/osc/osc_io.c
+++ b/drivers/staging/lustre/lustre/osc/osc_io.c
@@ -221,7 +221,7 @@ static void osc_page_touch_at(const struct lu_env *env,
 	       kms > loi->loi_kms ? "" : "not ", loi->loi_kms, kms,
 	       loi->loi_lvb.lvb_size);
 
-	attr->cat_mtime = attr->cat_ctime = LTIME_S(CURRENT_TIME);
+	attr->cat_mtime = attr->cat_ctime = ktime_get_real_seconds();
 	valid = CAT_MTIME | CAT_CTIME;
 	if (kms > loi->loi_kms) {
 		attr->cat_kms = kms;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 12/21] block: rbd: Replace non inode CURRENT_TIME with current_fs_time()
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (9 preceding siblings ...)
  2016-06-09  5:04 ` [PATCH 11/21] drivers: staging: lustre: Replace CURRENT_TIME with current_fs_time() Deepa Dinamani
@ 2016-06-09  5:04 ` Deepa Dinamani
  2016-06-09  5:04 ` [PATCH 13/21] fs: ocfs2: Use time64_t to represent orphan scan times Deepa Dinamani
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Ilya Dryomov, Sage Weil, Alex Elder, ceph-devel

CURRENT_TIME macro is not appropriate for filesystems as it
doesn't use the right granularity for filesystem timestamps.
Use current_fs_time() instead.

This is also in preparation for the patch that transitions
vfs timestamps to use 64 bit time and hence make them
y2038 safe. As part of the effort current_fs_time() will be
extended to do range checks. Hence, it is necessary for all
file system timestamps to use current_fs_time().

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: Sage Weil <sage@redhat.com>
Cc: Alex Elder <elder@kernel.org>
Cc: ceph-devel@vger.kernel.org
---
 drivers/block/rbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 81666a5..4dcafe4 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1888,7 +1888,7 @@ static void rbd_osd_req_format_write(struct rbd_obj_request *obj_request)
 {
 	struct ceph_osd_request *osd_req = obj_request->osd_req;
 
-	osd_req->r_mtime = CURRENT_TIME;
+	osd_req->r_mtime = current_fs_time(osd_req->r_inode->i_sb);
 	osd_req->r_data_offset = obj_request->offset;
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 13/21] fs: ocfs2: Use time64_t to represent orphan scan times
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (10 preceding siblings ...)
  2016-06-09  5:04 ` [PATCH 12/21] block: rbd: Replace non inode " Deepa Dinamani
@ 2016-06-09  5:04 ` Deepa Dinamani
  2016-06-09  5:04 ` [PATCH 14/21] fs: ocfs2: Replace CURRENT_TIME with ktime_get_real_seconds() Deepa Dinamani
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Mark Fasheh, Joel Becker, ocfs2-devel

struct timespec is not y2038 safe.
Use time64_t which is y2038 safe to represent orphan
scan times.
time64_t is sufficient here as only the seconds delta
times are relevant.

Also use appropriate time functions that return time in
time64_t format. Time functions now return monotonic
time instead of real time as only delta scan times are
relevant and these values are not persistent across
reboots.

The format string for the debug print is still using long
as this is only the time elapsed since the last scan and
long is sufficient to represent this value.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: ocfs2-devel@oss.oracle.com
---
 fs/ocfs2/journal.c | 4 ++--
 fs/ocfs2/ocfs2.h   | 2 +-
 fs/ocfs2/super.c   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index e607419..df76e60 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -1946,7 +1946,7 @@ static void ocfs2_queue_orphan_scan(struct ocfs2_super *osb)
 	 */
 	seqno++;
 	os->os_count++;
-	os->os_scantime = CURRENT_TIME;
+	os->os_scantime = ktime_get_seconds();
 unlock:
 	ocfs2_orphan_scan_unlock(osb, seqno);
 out:
@@ -2003,7 +2003,7 @@ void ocfs2_orphan_scan_start(struct ocfs2_super *osb)
 	struct ocfs2_orphan_scan *os;
 
 	os = &osb->osb_orphan_scan;
-	os->os_scantime = CURRENT_TIME;
+	os->os_scantime = ktime_get_seconds();
 	if (ocfs2_is_hard_readonly(osb) || ocfs2_mount_local(osb))
 		atomic_set(&os->os_state, ORPHAN_SCAN_INACTIVE);
 	else {
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index e63af7d..7e5958b 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -224,7 +224,7 @@ struct ocfs2_orphan_scan {
 	struct ocfs2_super 	*os_osb;
 	struct ocfs2_lock_res 	os_lockres;     /* lock to synchronize scans */
 	struct delayed_work 	os_orphan_scan_work;
-	struct timespec		os_scantime;  /* time this node ran the scan */
+	time64_t		os_scantime;  /* time this node ran the scan */
 	u32			os_count;      /* tracks node specific scans */
 	u32  			os_seqno;       /* tracks cluster wide scans */
 	atomic_t		os_state;              /* ACTIVE or INACTIVE */
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index d7cae33..dc56f07 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -337,7 +337,7 @@ static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len)
 		out += snprintf(buf + out, len - out, "Disabled\n");
 	else
 		out += snprintf(buf + out, len - out, "%lu seconds ago\n",
-				(get_seconds() - os->os_scantime.tv_sec));
+				(unsigned long)(ktime_get_seconds() - os->os_scantime));
 
 	out += snprintf(buf + out, len - out, "%10s => %3s  %10s\n",
 			"Slots", "Num", "RecoGen");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 14/21] fs: ocfs2: Replace CURRENT_TIME with ktime_get_real_seconds()
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (11 preceding siblings ...)
  2016-06-09  5:04 ` [PATCH 13/21] fs: ocfs2: Use time64_t to represent orphan scan times Deepa Dinamani
@ 2016-06-09  5:04 ` Deepa Dinamani
  2016-06-09  5:04 ` [PATCH 15/21] time: Add time64_to_tm() Deepa Dinamani
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Mark Fasheh, Joel Becker, ocfs2-devel

CURRENT_TIME is not y2038 safe.

Use y2038 safe ktime_get_real_seconds() here for timestamps.

struct heartbeat_block's hb_seq is already 64 bits wide and
accommodates times beyond y2038.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: ocfs2-devel@oss.oracle.com
---
 fs/ocfs2/cluster/heartbeat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 6aaf3e3..d13c646 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -737,7 +737,7 @@ static inline void o2hb_prepare_block(struct o2hb_region *reg,
 	hb_block = (struct o2hb_disk_heartbeat_block *)slot->ds_raw_block;
 	memset(hb_block, 0, reg->hr_block_bytes);
 	/* TODO: time stuff */
-	cputime = CURRENT_TIME.tv_sec;
+	cputime = ktime_get_real_seconds();
 	if (!cputime)
 		cputime = 1;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 15/21] time: Add time64_to_tm()
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (12 preceding siblings ...)
  2016-06-09  5:04 ` [PATCH 14/21] fs: ocfs2: Replace CURRENT_TIME with ktime_get_real_seconds() Deepa Dinamani
@ 2016-06-09  5:04 ` Deepa Dinamani
  2016-06-14 21:18   ` John Stultz
  2016-06-09  5:05 ` [PATCH 16/21] fnic: Use time64_t to represent trace timestamps Deepa Dinamani
                   ` (6 subsequent siblings)
  20 siblings, 1 reply; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	John Stultz

time_to_tm() takes time_t as an argument.
time_t is not y2038 safe.
Add time64_to_tm() that takes time64_t as an argument
which is y2038 safe.
The plan is to eventually replace all calls to time_to_tm()
by time64_to_tm().

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/time.h   | 15 ++++++++++++++-
 kernel/time/timeconv.c | 11 ++++++-----
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/include/linux/time.h b/include/linux/time.h
index 297f09f..4cea09d 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -205,7 +205,20 @@ struct tm {
 	int tm_yday;
 };
 
-void time_to_tm(time_t totalsecs, int offset, struct tm *result);
+void time64_to_tm(time64_t totalsecs, int offset, struct tm *result);
+
+/**
+ * time_to_tm - converts the calendar time to local broken-down time
+ *
+ * @totalsecs	the number of seconds elapsed since 00:00:00 on January 1, 1970,
+ *		Coordinated Universal Time (UTC).
+ * @offset	offset seconds adding to totalsecs.
+ * @result	pointer to struct tm variable to receive broken-down time
+ */
+static inline void time_to_tm(time_t totalsecs, int offset, struct tm *result)
+{
+	time64_to_tm(totalsecs, offset, result);
+}
 
 /**
  * timespec_to_ns - Convert timespec to nanoseconds
diff --git a/kernel/time/timeconv.c b/kernel/time/timeconv.c
index 86628e7..7142580 100644
--- a/kernel/time/timeconv.c
+++ b/kernel/time/timeconv.c
@@ -67,20 +67,21 @@ static const unsigned short __mon_yday[2][13] = {
 #define SECS_PER_DAY	(SECS_PER_HOUR * 24)
 
 /**
- * time_to_tm - converts the calendar time to local broken-down time
+ * time64_to_tm - converts the calendar time to local broken-down time
  *
  * @totalsecs	the number of seconds elapsed since 00:00:00 on January 1, 1970,
  *		Coordinated Universal Time (UTC).
  * @offset	offset seconds adding to totalsecs.
  * @result	pointer to struct tm variable to receive broken-down time
  */
-void time_to_tm(time_t totalsecs, int offset, struct tm *result)
+void time64_to_tm(time64_t totalsecs, int offset, struct tm *result)
 {
 	long days, rem, y;
+	int remainder;
 	const unsigned short *ip;
 
-	days = totalsecs / SECS_PER_DAY;
-	rem = totalsecs % SECS_PER_DAY;
+	days = div_s64_rem(totalsecs, SECS_PER_DAY, &remainder);
+	rem = remainder;
 	rem += offset;
 	while (rem < 0) {
 		rem += SECS_PER_DAY;
@@ -124,4 +125,4 @@ void time_to_tm(time_t totalsecs, int offset, struct tm *result)
 	result->tm_mon = y;
 	result->tm_mday = days + 1;
 }
-EXPORT_SYMBOL(time_to_tm);
+EXPORT_SYMBOL(time64_to_tm);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 16/21] fnic: Use time64_t to represent trace timestamps
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (13 preceding siblings ...)
  2016-06-09  5:04 ` [PATCH 15/21] time: Add time64_to_tm() Deepa Dinamani
@ 2016-06-09  5:05 ` Deepa Dinamani
  2016-06-09  5:05 ` [PATCH 17/21] audit: Use timespec64 to represent audit timestamps Deepa Dinamani
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:05 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Hiral Patel, Suma Ramars, Brian Uchino, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi

trace timestamps use struct timespec and CURRENT_TIME which
are not y2038 safe.
These timestamps are only part of the trace log on the machine
and are not shared with the fnic.
Replace then with y2038 safe struct timespec64 and
ktime_get_real_ts64(), respectively.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Hiral Patel <hiralpat@cisco.com>
Cc: Suma Ramars <sramars@cisco.com>
Cc: Brian Uchino <buchino@cisco.com>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/fnic/fnic_trace.c | 4 ++--
 drivers/scsi/fnic/fnic_trace.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c
index 4e15c4b..5a5fa01 100644
--- a/drivers/scsi/fnic/fnic_trace.c
+++ b/drivers/scsi/fnic/fnic_trace.c
@@ -613,7 +613,7 @@ int fnic_fc_trace_set_data(u32 host_no, u8 frame_type,
 			fc_trace_entries.rd_idx = 0;
 	}
 
-	fc_buf->time_stamp = CURRENT_TIME;
+	ktime_get_real_ts64(&fc_buf->time_stamp);
 	fc_buf->host_no = host_no;
 	fc_buf->frame_type = frame_type;
 
@@ -740,7 +740,7 @@ void copy_and_format_trace_data(struct fc_trace_hdr *tdata,
 
 	len = *orig_len;
 
-	time_to_tm(tdata->time_stamp.tv_sec, 0, &tm);
+	time64_to_tm(tdata->time_stamp.tv_sec, 0, &tm);
 
 	fmt = "%02d:%02d:%04ld %02d:%02d:%02d.%09lu ns%8x       %c%8x\t";
 	len += snprintf(fnic_dbgfs_prt->buffer + len,
diff --git a/drivers/scsi/fnic/fnic_trace.h b/drivers/scsi/fnic/fnic_trace.h
index a8aa057..e375d0c 100644
--- a/drivers/scsi/fnic/fnic_trace.h
+++ b/drivers/scsi/fnic/fnic_trace.h
@@ -72,7 +72,7 @@ struct fnic_trace_data {
 typedef struct fnic_trace_data fnic_trace_data_t;
 
 struct fc_trace_hdr {
-	struct timespec time_stamp;
+	struct timespec64 time_stamp;
 	u32 host_no;
 	u8 frame_type;
 	u8 frame_len;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 17/21] audit: Use timespec64 to represent audit timestamps
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (14 preceding siblings ...)
  2016-06-09  5:05 ` [PATCH 16/21] fnic: Use time64_t to represent trace timestamps Deepa Dinamani
@ 2016-06-09  5:05 ` Deepa Dinamani
  2016-06-09 14:31   ` Steve Grubb
  2016-06-09  5:05 ` [PATCH 18/21] fs: nfs: Make nfs boot time y2038 safe Deepa Dinamani
                   ` (4 subsequent siblings)
  20 siblings, 1 reply; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:05 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Paul Moore, Eric Paris, linux-audit

struct timespec is not y2038 safe.
Audit timestamps are recorded in string format into
an audit buffer for a given context.
These mark the entry timestamps for the syscalls.
Use y2038 safe struct timespec64 to represent the times.
The log strings can handle this transition as strings can
hold upto 1024 characters.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Eric Paris <eparis@redhat.com>
Cc: linux-audit@redhat.com
---
 include/linux/audit.h |  4 ++--
 kernel/audit.c        | 10 +++++-----
 kernel/audit.h        |  2 +-
 kernel/auditsc.c      |  6 +++---
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/linux/audit.h b/include/linux/audit.h
index 961a417..2f6a1123 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -335,7 +335,7 @@ static inline void audit_ptrace(struct task_struct *t)
 				/* Private API (for audit.c only) */
 extern unsigned int audit_serial(void);
 extern int auditsc_get_stamp(struct audit_context *ctx,
-			      struct timespec *t, unsigned int *serial);
+			      struct timespec64 *t, unsigned int *serial);
 extern int audit_set_loginuid(kuid_t loginuid);
 
 static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
@@ -510,7 +510,7 @@ static inline void __audit_seccomp(unsigned long syscall, long signr, int code)
 static inline void audit_seccomp(unsigned long syscall, long signr, int code)
 { }
 static inline int auditsc_get_stamp(struct audit_context *ctx,
-			      struct timespec *t, unsigned int *serial)
+			      struct timespec64 *t, unsigned int *serial)
 {
 	return 0;
 }
diff --git a/kernel/audit.c b/kernel/audit.c
index 22bb4f2..6c2f405 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1325,10 +1325,10 @@ unsigned int audit_serial(void)
 }
 
 static inline void audit_get_stamp(struct audit_context *ctx,
-				   struct timespec *t, unsigned int *serial)
+				   struct timespec64 *t, unsigned int *serial)
 {
 	if (!ctx || !auditsc_get_stamp(ctx, t, serial)) {
-		*t = CURRENT_TIME;
+		ktime_get_real_ts64(t);
 		*serial = audit_serial();
 	}
 }
@@ -1370,7 +1370,7 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
 				     int type)
 {
 	struct audit_buffer	*ab	= NULL;
-	struct timespec		t;
+	struct timespec64	t;
 	unsigned int		uninitialized_var(serial);
 	int reserve = 5; /* Allow atomic callers to go up to five
 			    entries over the normal backlog limit */
@@ -1422,8 +1422,8 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
 
 	audit_get_stamp(ab->ctx, &t, &serial);
 
-	audit_log_format(ab, "audit(%lu.%03lu:%u): ",
-			 t.tv_sec, t.tv_nsec/1000000, serial);
+	audit_log_format(ab, "audit(%llu.%03lu:%u): ",
+			 (unsigned long long)t.tv_sec, t.tv_nsec/1000000, serial);
 	return ab;
 }
 
diff --git a/kernel/audit.h b/kernel/audit.h
index cbbe6bb..029d674 100644
--- a/kernel/audit.h
+++ b/kernel/audit.h
@@ -111,7 +111,7 @@ struct audit_context {
 	enum audit_state    state, current_state;
 	unsigned int	    serial;     /* serial number for record */
 	int		    major;      /* syscall number */
-	struct timespec	    ctime;      /* time of syscall entry */
+	struct timespec64   ctime;      /* time of syscall entry */
 	unsigned long	    argv[4];    /* syscall arguments */
 	long		    return_code;/* syscall return code */
 	u64		    prio;
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 62ab53d..ecebb3c 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1523,7 +1523,7 @@ void __audit_syscall_entry(int major, unsigned long a1, unsigned long a2,
 		return;
 
 	context->serial     = 0;
-	context->ctime      = CURRENT_TIME;
+	ktime_get_real_ts64(&context->ctime);
 	context->in_syscall = 1;
 	context->current_state  = state;
 	context->ppid       = 0;
@@ -1932,13 +1932,13 @@ EXPORT_SYMBOL_GPL(__audit_inode_child);
 /**
  * auditsc_get_stamp - get local copies of audit_context values
  * @ctx: audit_context for the task
- * @t: timespec to store time recorded in the audit_context
+ * @t: timespec64 to store time recorded in the audit_context
  * @serial: serial value that is recorded in the audit_context
  *
  * Also sets the context as auditable.
  */
 int auditsc_get_stamp(struct audit_context *ctx,
-		       struct timespec *t, unsigned int *serial)
+		       struct timespec64 *t, unsigned int *serial)
 {
 	if (!ctx->in_syscall)
 		return 0;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 18/21] fs: nfs: Make nfs boot time y2038 safe
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (15 preceding siblings ...)
  2016-06-09  5:05 ` [PATCH 17/21] audit: Use timespec64 to represent audit timestamps Deepa Dinamani
@ 2016-06-09  5:05 ` Deepa Dinamani
  2016-06-09 19:23   ` Trond Myklebust
  2016-06-09  5:05 ` [PATCH 19/21] libceph: Remove CURRENT_TIME references Deepa Dinamani
                   ` (3 subsequent siblings)
  20 siblings, 1 reply; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:05 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Trond Myklebust, Anna Schumaker, linux-nfs

boot_time is represented as a struct timespec.
struct timespec and CURRENT_TIME are not y2038 safe.
Overall, the plan is to use timespec64 for all internal
kernel representation of timestamps.
CURRENT_TIME will also be removed.
Use struct timespec64 to represent boot_time.
And, ktime_get_real_ts64() for the boot_time value.

boot_time is used to construct the nfs client boot verifier.
This will now wrap in 2106 instead of 2038 on 32-bit systems.
The server only relies on the value being persistent until
reboot so the wrapping should be fine.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Anna Schumaker <anna.schumaker@netapp.com>
Cc: linux-nfs@vger.kernel.org
---
 fs/nfs/client.c | 2 +-
 fs/nfs/netns.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 0c96528..406972e 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -1080,7 +1080,7 @@ void nfs_clients_init(struct net *net)
 	idr_init(&nn->cb_ident_idr);
 #endif
 	spin_lock_init(&nn->nfs_client_lock);
-	nn->boot_time = CURRENT_TIME;
+	ktime_get_real_ts64(&nn->boot_time);
 }
 
 #ifdef CONFIG_PROC_FS
diff --git a/fs/nfs/netns.h b/fs/nfs/netns.h
index f0e06e4..48d6b95 100644
--- a/fs/nfs/netns.h
+++ b/fs/nfs/netns.h
@@ -29,7 +29,7 @@ struct nfs_net {
 	int cb_users[NFS4_MAX_MINOR_VERSION + 1];
 #endif
 	spinlock_t nfs_client_lock;
-	struct timespec boot_time;
+	struct timespec64 boot_time;
 #ifdef CONFIG_PROC_FS
 	struct proc_dir_entry *proc_nfsfs;
 #endif
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 19/21] libceph: Remove CURRENT_TIME references
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (16 preceding siblings ...)
  2016-06-09  5:05 ` [PATCH 18/21] fs: nfs: Make nfs boot time y2038 safe Deepa Dinamani
@ 2016-06-09  5:05 ` Deepa Dinamani
  2016-06-09  5:05 ` [PATCH 20/21] libceph: Replace CURRENT_TIME with ktime_get_real_ts Deepa Dinamani
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:05 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Yan, Zheng, Sage Weil, Ilya Dryomov, ceph-devel

CURRENT_TIME is not y2038 safe.
The macro will be deleted and all the references to it
will be replaced by ktime_get_* apis.

struct timespec is also not y2038 safe.
Retain timespec for timestamp representation here as ceph
uses it internally everywhere.
These references will be changed to use struct timespec64
in a separate patch.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: "Yan, Zheng" <zyan@redhat.com>
Cc: Sage Weil <sage@redhat.com>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: ceph-devel@vger.kernel.org
---
 net/ceph/messenger.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index a550289..1825eed 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -1366,8 +1366,9 @@ static void prepare_write_keepalive(struct ceph_connection *con)
 	dout("prepare_write_keepalive %p\n", con);
 	con_out_kvec_reset(con);
 	if (con->peer_features & CEPH_FEATURE_MSGR_KEEPALIVE2) {
-		struct timespec now = CURRENT_TIME;
+		struct timespec now;
 
+		ktime_get_real_ts(&now);
 		con_out_kvec_add(con, sizeof(tag_keepalive2), &tag_keepalive2);
 		ceph_encode_timespec(&con->out_temp_keepalive2, &now);
 		con_out_kvec_add(con, sizeof(con->out_temp_keepalive2),
@@ -3149,8 +3150,9 @@ bool ceph_con_keepalive_expired(struct ceph_connection *con,
 {
 	if (interval > 0 &&
 	    (con->peer_features & CEPH_FEATURE_MSGR_KEEPALIVE2)) {
-		struct timespec now = CURRENT_TIME;
+		struct timespec now;
 		struct timespec ts;
+		ktime_get_real_ts(&now);
 		jiffies_to_timespec(interval, &ts);
 		ts = timespec_add(con->last_keepalive_ack, ts);
 		return timespec_compare(&now, &ts) >= 0;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 20/21] libceph: Replace CURRENT_TIME with ktime_get_real_ts
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (17 preceding siblings ...)
  2016-06-09  5:05 ` [PATCH 19/21] libceph: Remove CURRENT_TIME references Deepa Dinamani
@ 2016-06-09  5:05 ` Deepa Dinamani
  2016-06-09  5:05 ` [PATCH 21/21] time: Delete CURRENT_TIME_SEC and CURRENT_TIME macro Deepa Dinamani
  2016-06-09  7:51 ` [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Felipe Balbi
  20 siblings, 0 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:05 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Yan, Zheng, Sage Weil, Ilya Dryomov, ceph-devel

CURRENT_TIME is not y2038 safe.
The macro will be deleted and all the references to it
will be replaced by ktime_get_* apis.

struct timespec is also not y2038 safe.
Retain timespec for timestamp representation here as ceph
uses it internally everywhere.
These references will be changed to use struct timespec64
in a separate patch.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: "Yan, Zheng" <zyan@redhat.com>
Cc: Sage Weil <sage@redhat.com>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: ceph-devel@vger.kernel.org
---
 net/ceph/osd_client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 8946959..44eb2d0 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -3567,7 +3567,7 @@ ceph_osdc_watch(struct ceph_osd_client *osdc,
 	ceph_oid_copy(&lreq->t.base_oid, oid);
 	ceph_oloc_copy(&lreq->t.base_oloc, oloc);
 	lreq->t.flags = CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK;
-	lreq->mtime = CURRENT_TIME;
+	ktime_get_real_ts(&lreq->mtime);
 
 	lreq->reg_req = alloc_linger_request(lreq);
 	if (!lreq->reg_req) {
@@ -3625,7 +3625,7 @@ int ceph_osdc_unwatch(struct ceph_osd_client *osdc,
 	ceph_oid_copy(&req->r_base_oid, &lreq->t.base_oid);
 	ceph_oloc_copy(&req->r_base_oloc, &lreq->t.base_oloc);
 	req->r_flags = CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK;
-	req->r_mtime = CURRENT_TIME;
+	ktime_get_real_ts(&req->r_mtime);
 	osd_req_op_watch_init(req, 0, lreq->linger_id,
 			      CEPH_OSD_WATCH_OP_UNWATCH);
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 21/21] time: Delete CURRENT_TIME_SEC and CURRENT_TIME macro
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (18 preceding siblings ...)
  2016-06-09  5:05 ` [PATCH 20/21] libceph: Replace CURRENT_TIME with ktime_get_real_ts Deepa Dinamani
@ 2016-06-09  5:05 ` Deepa Dinamani
  2016-06-14 21:20   ` John Stultz
  2016-06-09  7:51 ` [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Felipe Balbi
  20 siblings, 1 reply; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09  5:05 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	John Stultz

All uses of these macors have been replaced by other
time functions.
These macros are also not y2038 safe.
And, all its usecases can be fulfilled by y2038
safe ktime_get_* variants.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/time.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/linux/time.h b/include/linux/time.h
index 4cea09d..a5a07c0 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -151,9 +151,6 @@ static inline bool timespec_inject_offset_valid(const struct timespec *ts)
 	return true;
 }
 
-#define CURRENT_TIME		(current_kernel_time())
-#define CURRENT_TIME_SEC	((struct timespec) { get_seconds(), 0 })
-
 /* Some architectures do not supply their own clocksource.
  * This is mainly the case in architectures that get their
  * inter-tick times by reading the counter on their interval
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()
  2016-06-09  5:04 ` [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time() Deepa Dinamani
@ 2016-06-09  7:35   ` Jan Kara
  2016-06-09 19:15     ` Linus Torvalds
  2016-06-09 12:31   ` Bob Copeland
  2016-06-10 22:21   ` Arnd Bergmann
  2 siblings, 1 reply; 54+ messages in thread
From: Jan Kara @ 2016-06-09  7:35 UTC (permalink / raw)
  To: Deepa Dinamani
  Cc: linux-fsdevel, linux-kernel, Arnd Bergmann, Thomas Gleixner,
	Al Viro, Linus Torvalds, y2038, Artem Bityutskiy, Adrian Hunter,
	linux-mtd, Evgeniy Dushistov, OGAWA Hirofumi, Jan Kara,
	linux-ext4, David Howells, linux-afs, Tigran A. Aivazian,
	Theodore Ts'o, Andreas Dilger, Jan Kara, Jan Harkes, coda,
	codalist, Bob Copeland, linux-karma-devel, Christoph Hellwig

On Wed 08-06-16 22:04:45, Deepa Dinamani wrote:
> CURRENT_TIME_SEC is not y2038 safe. current_fs_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_fs_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.
> 
> Also note that filesystem specific times like the birthtime,
> creation time that were using same interfaces to obtain time
> retain same logistics.

You create line longer than 80 characters for affs and reiserfs. Please
wrap those lines properly. Other than that feel free to add:

Acked-by: Jan Kara <jack@suse.cz>

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 06/21] fs: udf: Replace CURRENT_TIME with current_fs_time()
  2016-06-09  5:04 ` [PATCH 06/21] fs: udf: Replace CURRENT_TIME with current_fs_time() Deepa Dinamani
@ 2016-06-09  7:41   ` Jan Kara
  2016-06-10  0:53     ` Deepa Dinamani
  0 siblings, 1 reply; 54+ messages in thread
From: Jan Kara @ 2016-06-09  7:41 UTC (permalink / raw)
  To: Deepa Dinamani
  Cc: linux-fsdevel, linux-kernel, Arnd Bergmann, Thomas Gleixner,
	Al Viro, Linus Torvalds, y2038, Jan Kara

On Wed 08-06-16 22:04:50, Deepa Dinamani wrote:
> CURRENT_TIME is not y2038 safe.
> 
> CURRENT_TIME macro is also not appropriate for filesystems
> as it doesn't use the right granularity for filesystem
> timestamps.
> 
> Logical Volume Integrity format is described to have the
> same timestamp format for "Recording Date and time" as
> the other [a,c,m]timestamps.
> Hence using current_fs_time() instead here promises to
> maintain the same granularity as other timestamps.
> 
> This is also in preparation for the patch that transitions
> vfs timestamps to use 64 bit time and hence make them
> y2038 safe. As part of the effort current_fs_time() will be
> extended to do range checks.

Just one nit below.

> @@ -2030,7 +2030,7 @@ static void udf_close_lvid(struct super_block *sb)
>  	mutex_lock(&sbi->s_alloc_mutex);
>  	lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
>  	lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
> -	udf_time_to_disk_stamp(&lvid->recordingDateAndTime, CURRENT_TIME);
> +	udf_time_to_disk_stamp(&lvid->recordingDateAndTime, current_fs_time(sb));
>  	if (UDF_MAX_WRITE_VERSION > le16_to_cpu(lvidiu->maxUDFWriteRev))
>  		lvidiu->maxUDFWriteRev = cpu_to_le16(UDF_MAX_WRITE_VERSION);
>  	if (sbi->s_udfrev > le16_to_cpu(lvidiu->minUDFReadRev))

Please wrap this line properly so that it does not exceed 80 characters.
Other than that feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros
  2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
                   ` (19 preceding siblings ...)
  2016-06-09  5:05 ` [PATCH 21/21] time: Delete CURRENT_TIME_SEC and CURRENT_TIME macro Deepa Dinamani
@ 2016-06-09  7:51 ` Felipe Balbi
  20 siblings, 0 replies; 54+ messages in thread
From: Felipe Balbi @ 2016-06-09  7:51 UTC (permalink / raw)
  To: Deepa Dinamani, linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Anna Schumaker, Anton Vorontsov, Benny Halevy, Boaz Harrosh,
	Changman Lee, Chris Mason, Colin Cross, Dave Kleikamp,
	David S. Miller, David Sterba, Eric Van Hensbergen, Hugh Dickins,
	Ian Kent, Jaegeuk Kim, Joern Engel, Josef Bacik, Kees Cook,
	Latchesar Ionkov, Matt Fleming, Matthew Garrett, Miklos Szeredi,
	Nadia Yvette Chambers, Prasad Joshi, Robert Richter, Ron Minnich,
	Tony Luck, Trond Myklebust, autofs, cluster-devel,
	jfs-discussion, linux-btrfs, linux-efi, linux-f2fs-devel,
	linux-mm, linux-nfs, linux-nilfs, linuxppc-dev, linux-rdma,
	linux-s390, linux-security-module, linux-usb, logfs, netdev,
	ocfs2-devel, oprofile-list, osd-dev, selinux, v9fs-developer

[-- Attachment #1: Type: text/plain, Size: 270 bytes --]


Hi,

Deepa Dinamani <deepa.kernel@gmail.com> writes:
>  drivers/usb/gadget/function/f_fs.c                 |  2 +-
>  drivers/usb/gadget/legacy/inode.c                  |  2 +-

for drivers/usb/gadget:

Acked-by: Felipe Balbi <balbi@kernel.org>

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()
  2016-06-09  5:04 ` [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time() Deepa Dinamani
  2016-06-09  7:35   ` Jan Kara
@ 2016-06-09 12:31   ` Bob Copeland
  2016-06-10 22:21   ` Arnd Bergmann
  2 siblings, 0 replies; 54+ messages in thread
From: Bob Copeland @ 2016-06-09 12:31 UTC (permalink / raw)
  To: Deepa Dinamani
  Cc: linux-fsdevel, linux-kernel, Arnd Bergmann, Thomas Gleixner,
	Al Viro, Linus Torvalds, y2038, Artem Bityutskiy, Adrian Hunter,
	linux-mtd, Evgeniy Dushistov, OGAWA Hirofumi, Jan Kara,
	linux-ext4, David Howells, linux-afs, Tigran A. Aivazian,
	Theodore Ts'o, Andreas Dilger, Jan Kara, Jan Harkes, coda,
	codalist, linux-karma-devel, Christoph Hellwig

On Wed, Jun 08, 2016 at 10:04:45PM -0700, Deepa Dinamani wrote:
> CURRENT_TIME_SEC is not y2038 safe. current_fs_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.

[...]

> Cc: Bob Copeland <me@bobcopeland.com>

OMFS parts look sane, thanks.

-- 
Bob Copeland %% http://bobcopeland.com/

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 17/21] audit: Use timespec64 to represent audit timestamps
  2016-06-09  5:05 ` [PATCH 17/21] audit: Use timespec64 to represent audit timestamps Deepa Dinamani
@ 2016-06-09 14:31   ` Steve Grubb
  2016-06-09 23:59     ` Richard Guy Briggs
  2016-06-10  0:45     ` Deepa Dinamani
  0 siblings, 2 replies; 54+ messages in thread
From: Steve Grubb @ 2016-06-09 14:31 UTC (permalink / raw)
  To: linux-audit
  Cc: Deepa Dinamani, linux-fsdevel, linux-kernel, Arnd Bergmann,
	y2038, Al Viro, Thomas Gleixner, Linus Torvalds

On Wednesday, June 08, 2016 10:05:01 PM Deepa Dinamani wrote:
> struct timespec is not y2038 safe.
> Audit timestamps are recorded in string format into
> an audit buffer for a given context.
> These mark the entry timestamps for the syscalls.
> Use y2038 safe struct timespec64 to represent the times.
> The log strings can handle this transition as strings can
> hold upto 1024 characters.

Have you tested this with ausearch or any audit utilities? As an aside, a time 
stamp that is up to 1024 characters long is terribly wasteful considering how 
many events we get.

-Steve


> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
> Cc: Paul Moore <paul@paul-moore.com>
> Cc: Eric Paris <eparis@redhat.com>
> Cc: linux-audit@redhat.com
> ---
>  include/linux/audit.h |  4 ++--
>  kernel/audit.c        | 10 +++++-----
>  kernel/audit.h        |  2 +-
>  kernel/auditsc.c      |  6 +++---
>  4 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/include/linux/audit.h b/include/linux/audit.h
> index 961a417..2f6a1123 100644
> --- a/include/linux/audit.h
> +++ b/include/linux/audit.h
> @@ -335,7 +335,7 @@ static inline void audit_ptrace(struct task_struct *t)
>  				/* Private API (for audit.c only) */
>  extern unsigned int audit_serial(void);
>  extern int auditsc_get_stamp(struct audit_context *ctx,
> -			      struct timespec *t, unsigned int *serial);
> +			      struct timespec64 *t, unsigned int *serial);
>  extern int audit_set_loginuid(kuid_t loginuid);
> 
>  static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
> @@ -510,7 +510,7 @@ static inline void __audit_seccomp(unsigned long
> syscall, long signr, int code) static inline void audit_seccomp(unsigned
> long syscall, long signr, int code) { }
>  static inline int auditsc_get_stamp(struct audit_context *ctx,
> -			      struct timespec *t, unsigned int *serial)
> +			      struct timespec64 *t, unsigned int *serial)
>  {
>  	return 0;
>  }
> diff --git a/kernel/audit.c b/kernel/audit.c
> index 22bb4f2..6c2f405 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -1325,10 +1325,10 @@ unsigned int audit_serial(void)
>  }
> 
>  static inline void audit_get_stamp(struct audit_context *ctx,
> -				   struct timespec *t, unsigned int *serial)
> +				   struct timespec64 *t, unsigned int *serial)
>  {
>  	if (!ctx || !auditsc_get_stamp(ctx, t, serial)) {
> -		*t = CURRENT_TIME;
> +		ktime_get_real_ts64(t);
>  		*serial = audit_serial();
>  	}
>  }
> @@ -1370,7 +1370,7 @@ struct audit_buffer *audit_log_start(struct
> audit_context *ctx, gfp_t gfp_mask, int type)
>  {
>  	struct audit_buffer	*ab	= NULL;
> -	struct timespec		t;
> +	struct timespec64	t;
>  	unsigned int		uninitialized_var(serial);
>  	int reserve = 5; /* Allow atomic callers to go up to five
>  			    entries over the normal backlog limit */
> @@ -1422,8 +1422,8 @@ struct audit_buffer *audit_log_start(struct
> audit_context *ctx, gfp_t gfp_mask,
> 
>  	audit_get_stamp(ab->ctx, &t, &serial);
> 
> -	audit_log_format(ab, "audit(%lu.%03lu:%u): ",
> -			 t.tv_sec, t.tv_nsec/1000000, serial);
> +	audit_log_format(ab, "audit(%llu.%03lu:%u): ",
> +			 (unsigned long long)t.tv_sec, t.tv_nsec/1000000, serial);
>  	return ab;
>  }
> 
> diff --git a/kernel/audit.h b/kernel/audit.h
> index cbbe6bb..029d674 100644
> --- a/kernel/audit.h
> +++ b/kernel/audit.h
> @@ -111,7 +111,7 @@ struct audit_context {
>  	enum audit_state    state, current_state;
>  	unsigned int	    serial;     /* serial number for record */
>  	int		    major;      /* syscall number */
> -	struct timespec	    ctime;      /* time of syscall entry */
> +	struct timespec64   ctime;      /* time of syscall entry */
>  	unsigned long	    argv[4];    /* syscall arguments */
>  	long		    return_code;/* syscall return code */
>  	u64		    prio;
> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index 62ab53d..ecebb3c 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -1523,7 +1523,7 @@ void __audit_syscall_entry(int major, unsigned long
> a1, unsigned long a2, return;
> 
>  	context->serial     = 0;
> -	context->ctime      = CURRENT_TIME;
> +	ktime_get_real_ts64(&context->ctime);
>  	context->in_syscall = 1;
>  	context->current_state  = state;
>  	context->ppid       = 0;
> @@ -1932,13 +1932,13 @@ EXPORT_SYMBOL_GPL(__audit_inode_child);
>  /**
>   * auditsc_get_stamp - get local copies of audit_context values
>   * @ctx: audit_context for the task
> - * @t: timespec to store time recorded in the audit_context
> + * @t: timespec64 to store time recorded in the audit_context
>   * @serial: serial value that is recorded in the audit_context
>   *
>   * Also sets the context as auditable.
>   */
>  int auditsc_get_stamp(struct audit_context *ctx,
> -		       struct timespec *t, unsigned int *serial)
> +		       struct timespec64 *t, unsigned int *serial)
>  {
>  	if (!ctx->in_syscall)
>  		return 0;

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps
  2016-06-09  5:04 ` [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps Deepa Dinamani
@ 2016-06-09 18:45   ` Linus Torvalds
  2016-06-09 18:55     ` Linus Torvalds
  2016-06-10 22:19     ` [Y2038] " Arnd Bergmann
  0 siblings, 2 replies; 54+ messages in thread
From: Linus Torvalds @ 2016-06-09 18:45 UTC (permalink / raw)
  To: Deepa Dinamani
  Cc: linux-fsdevel, Linux Kernel Mailing List, Arnd Bergmann,
	Thomas Gleixner, Al Viro, y2038, Theodore Ts'o,
	Andreas Dilger, linux-ext4

On Wed, Jun 8, 2016 at 10:04 PM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> CURRENT_TIME_SEC and CURRENT_TIME are not y2038 safe.
> current_fs_time() will be transitioned to be y2038 safe
> along with vfs.
>
> current_fs_time() returns timestamps according to the
> granularities set in the super_block.

All existing users and all the ones in this patch (and the others too,
although I didn't go through them very carefully) really would prefer
just passing in the inode directly, rather than the superblock.

So I don't want to add more users of this broken interface.  It was a
mistake to use the superblock. The fact that the time granularity
exists there is pretty much irrelevant. If every single user wants to
use an inode pointer, then that is what the function should get.

                 Linus

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps
  2016-06-09 18:45   ` Linus Torvalds
@ 2016-06-09 18:55     ` Linus Torvalds
  2016-06-10 22:19     ` [Y2038] " Arnd Bergmann
  1 sibling, 0 replies; 54+ messages in thread
From: Linus Torvalds @ 2016-06-09 18:55 UTC (permalink / raw)
  To: Deepa Dinamani
  Cc: linux-fsdevel, Linux Kernel Mailing List, Arnd Bergmann,
	Thomas Gleixner, Al Viro, y2038, Theodore Ts'o,
	Andreas Dilger, linux-ext4

On Thu, Jun 9, 2016 at 11:45 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> All existing users and all the ones in this patch (and the others too,
> although I didn't go through them very carefully) really would prefer
> just passing in the inode directly, rather than the superblock.

Actually, there seems to be one exception to that "all existing
users", and that one exception (btrfs transacation time) really seems
to be broken. Exactly because it's *not* setting an inode time, it
shouldn't have used current_fs_time() to begin with, because it is
just setting an internal filesystem timestamp.

So not making the argument inode-related seems to actually encourage
people to misuse this function.

                Linus

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()
  2016-06-09  7:35   ` Jan Kara
@ 2016-06-09 19:15     ` Linus Torvalds
  2016-06-09 20:41       ` Deepa Dinamani
  0 siblings, 1 reply; 54+ messages in thread
From: Linus Torvalds @ 2016-06-09 19:15 UTC (permalink / raw)
  To: Jan Kara
  Cc: Deepa Dinamani, linux-fsdevel, Linux Kernel Mailing List,
	Arnd Bergmann, Thomas Gleixner, Al Viro, y2038, Artem Bityutskiy,
	Adrian Hunter, linux-mtd, Evgeniy Dushistov, OGAWA Hirofumi,
	Jan Kara, linux-ext4, David Howells, linux-afs,
	Tigran A. Aivazian, Theodore Ts'o, Andreas Dilger,
	Jan Harkes, coda, codalist, Bob Copeland, linux-karma-devel,
	Christoph Hellwig

On Thu, Jun 9, 2016 at 12:35 AM, Jan Kara <jack@suse.cz> wrote:
>
> You create line longer than 80 characters for affs and reiserfs. Please
> wrap those lines properly.

No, please do *NOT* do things like that.

These kind of mechanical patches should

 (a) be as mechanical as possible (and see elsewhere about why I think
'sb' should be 'inode' and the patch should have been 95% automated
with a trivial script thanks to that change)

 (b) be made as easy to verify visually as possible.

That (b) means that a conversion should *not* add whitespace fixups or
add other non-mechanical cleanups, because it's a *lot* easier to see
that a conversion like

-       inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
+       inode->i_mtime = inode->i_ctime = current_fs_time(inode);

makes no other changes, but if you start doing line-splitting or other
transformations (add new variables etc to get at 'sb'), suddenly you
have to verify the patch at a completely different level.

In other words, it's actually really important to make these kinds of
bulk changes be very very obvious. Including to the point of making
them visually easier to scan as a patch by not making any other
changes.

              Linus

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 18/21] fs: nfs: Make nfs boot time y2038 safe
  2016-06-09  5:05 ` [PATCH 18/21] fs: nfs: Make nfs boot time y2038 safe Deepa Dinamani
@ 2016-06-09 19:23   ` Trond Myklebust
  2016-06-09 21:10     ` Deepa Dinamani
  0 siblings, 1 reply; 54+ messages in thread
From: Trond Myklebust @ 2016-06-09 19:23 UTC (permalink / raw)
  To: Deepa Dinamani, linux-fsdevel, linux-kernel
  Cc: Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Anna Schumaker, linux-nfs



On 6/9/16, 01:05, "Deepa Dinamani" <deepa.kernel@gmail.com> wrote:

>boot_time is represented as a struct timespec.
>struct timespec and CURRENT_TIME are not y2038 safe.
>Overall, the plan is to use timespec64 for all internal
>kernel representation of timestamps.
>CURRENT_TIME will also be removed.
>Use struct timespec64 to represent boot_time.
>And, ktime_get_real_ts64() for the boot_time value.
>
>boot_time is used to construct the nfs client boot verifier.
>This will now wrap in 2106 instead of 2038 on 32-bit systems.
>The server only relies on the value being persistent until
>reboot so the wrapping should be fine.

We really do not give a damn about wraparound here, since the boot time is only ever compared for an exact match, and the odds of two reboots occurring exactly 2^32 * 10^9 nanoseconds apart are cosmically small...

If struct timespec is going away, can we just convert this into a ktime_t?

Trond

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()
  2016-06-09 19:15     ` Linus Torvalds
@ 2016-06-09 20:41       ` Deepa Dinamani
  0 siblings, 0 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09 20:41 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Jan Kara, linux-fsdevel, Linux Kernel Mailing List,
	Arnd Bergmann, Thomas Gleixner, Al Viro, y2038, Artem Bityutskiy,
	Adrian Hunter, linux-mtd, Evgeniy Dushistov, OGAWA Hirofumi,
	Jan Kara, linux-ext4, David Howells, linux-afs,
	Tigran A. Aivazian, Theodore Ts'o, Andreas Dilger,
	Jan Harkes, coda, codalist, Bob Copeland, linux-karma-devel,
	Christoph Hellwig

On Thu, Jun 9, 2016 at 12:15 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Thu, Jun 9, 2016 at 12:35 AM, Jan Kara <jack@suse.cz> wrote:
>>
>> You create line longer than 80 characters for affs and reiserfs. Please
>> wrap those lines properly.
>
> No, please do *NOT* do things like that.
>
> These kind of mechanical patches should
>
>  (a) be as mechanical as possible (and see elsewhere about why I think
> 'sb' should be 'inode' and the patch should have been 95% automated
> with a trivial script thanks to that change)
>
>  (b) be made as easy to verify visually as possible.
>
> That (b) means that a conversion should *not* add whitespace fixups or
> add other non-mechanical cleanups, because it's a *lot* easier to see
> that a conversion like
>
> -       inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
> +       inode->i_mtime = inode->i_ctime = current_fs_time(inode);
>
> makes no other changes, but if you start doing line-splitting or other
> transformations (add new variables etc to get at 'sb'), suddenly you
> have to verify the patch at a completely different level.
>
> In other words, it's actually really important to make these kinds of
> bulk changes be very very obvious. Including to the point of making
> them visually easier to scan as a patch by not making any other
> changes.

Thanks for the guidelines.
Only patches 1 and 4 are mechanical.
All others need some kind of inspection/ verification.
I will keep these in mind for updating 1 and 4.

-Deepa

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 18/21] fs: nfs: Make nfs boot time y2038 safe
  2016-06-09 19:23   ` Trond Myklebust
@ 2016-06-09 21:10     ` Deepa Dinamani
  2016-06-10 13:12       ` Anna Schumaker
  0 siblings, 1 reply; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-09 21:10 UTC (permalink / raw)
  To: Trond Myklebust
  Cc: linux-fsdevel, linux-kernel, Arnd Bergmann, Thomas Gleixner,
	Al Viro, Linus Torvalds, y2038, Anna Schumaker, linux-nfs

>>boot_time is represented as a struct timespec.
>>struct timespec and CURRENT_TIME are not y2038 safe.
>>Overall, the plan is to use timespec64 for all internal
>>kernel representation of timestamps.
>>CURRENT_TIME will also be removed.
>>Use struct timespec64 to represent boot_time.
>>And, ktime_get_real_ts64() for the boot_time value.
>>
>>boot_time is used to construct the nfs client boot verifier.
>>This will now wrap in 2106 instead of 2038 on 32-bit systems.
>>The server only relies on the value being persistent until
>>reboot so the wrapping should be fine.
>
> We really do not give a damn about wraparound here, since the boot time is
> only ever compared for an exact match, and the odds of two reboots occurring
> exactly 2^32 * 10^9 nanoseconds apart are cosmically small...
> If struct timespec is going away, can we just convert this into a ktime_t?

timespec64 is the same as timespec already on 64 bit machines.
But, yes, we can use ktime_t here.

Did you mean the internal storage value or the wire boo_time used for verifier?
In case you don't want to change the wire value, then we will have a division
operation, every time the verifier needs to be sent.

-Deepa

-Deepa

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 17/21] audit: Use timespec64 to represent audit timestamps
  2016-06-09 14:31   ` Steve Grubb
@ 2016-06-09 23:59     ` Richard Guy Briggs
  2016-06-10  0:19       ` Steve Grubb
  2016-06-15 21:23       ` Paul Moore
  2016-06-10  0:45     ` Deepa Dinamani
  1 sibling, 2 replies; 54+ messages in thread
From: Richard Guy Briggs @ 2016-06-09 23:59 UTC (permalink / raw)
  To: Steve Grubb
  Cc: linux-audit, Arnd Bergmann, y2038, linux-kernel, Al Viro,
	linux-fsdevel, Thomas Gleixner, Linus Torvalds, Deepa Dinamani

On 16/06/09, Steve Grubb wrote:
> On Wednesday, June 08, 2016 10:05:01 PM Deepa Dinamani wrote:
> > struct timespec is not y2038 safe.
> > Audit timestamps are recorded in string format into
> > an audit buffer for a given context.
> > These mark the entry timestamps for the syscalls.
> > Use y2038 safe struct timespec64 to represent the times.
> > The log strings can handle this transition as strings can
> > hold upto 1024 characters.
> 
> Have you tested this with ausearch or any audit utilities? As an aside, a time 
> stamp that is up to 1024 characters long is terribly wasteful considering how 
> many events we get.

Steve,

I don't expect the size of the time stamp text to change since the
format isn't being changed and I don't expect the date stamp text length
to change until Y10K, but you never know what will happen in 8
millenia...  (Who knows, maybe that damn Linux server in my basement
will still be running then...)

Isn't the maximum message length MAX_AUDIT_MESSAGE_LENGTH (8970 octets)?

> -Steve
> 
> > Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
> > Cc: Paul Moore <paul@paul-moore.com>
> > Cc: Eric Paris <eparis@redhat.com>
> > Cc: linux-audit@redhat.com
> > ---
> >  include/linux/audit.h |  4 ++--
> >  kernel/audit.c        | 10 +++++-----
> >  kernel/audit.h        |  2 +-
> >  kernel/auditsc.c      |  6 +++---
> >  4 files changed, 11 insertions(+), 11 deletions(-)
> > 
> > diff --git a/include/linux/audit.h b/include/linux/audit.h
> > index 961a417..2f6a1123 100644
> > --- a/include/linux/audit.h
> > +++ b/include/linux/audit.h
> > @@ -335,7 +335,7 @@ static inline void audit_ptrace(struct task_struct *t)
> >  				/* Private API (for audit.c only) */
> >  extern unsigned int audit_serial(void);
> >  extern int auditsc_get_stamp(struct audit_context *ctx,
> > -			      struct timespec *t, unsigned int *serial);
> > +			      struct timespec64 *t, unsigned int *serial);
> >  extern int audit_set_loginuid(kuid_t loginuid);
> > 
> >  static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
> > @@ -510,7 +510,7 @@ static inline void __audit_seccomp(unsigned long
> > syscall, long signr, int code) static inline void audit_seccomp(unsigned
> > long syscall, long signr, int code) { }
> >  static inline int auditsc_get_stamp(struct audit_context *ctx,
> > -			      struct timespec *t, unsigned int *serial)
> > +			      struct timespec64 *t, unsigned int *serial)
> >  {
> >  	return 0;
> >  }
> > diff --git a/kernel/audit.c b/kernel/audit.c
> > index 22bb4f2..6c2f405 100644
> > --- a/kernel/audit.c
> > +++ b/kernel/audit.c
> > @@ -1325,10 +1325,10 @@ unsigned int audit_serial(void)
> >  }
> > 
> >  static inline void audit_get_stamp(struct audit_context *ctx,
> > -				   struct timespec *t, unsigned int *serial)
> > +				   struct timespec64 *t, unsigned int *serial)
> >  {
> >  	if (!ctx || !auditsc_get_stamp(ctx, t, serial)) {
> > -		*t = CURRENT_TIME;
> > +		ktime_get_real_ts64(t);
> >  		*serial = audit_serial();
> >  	}
> >  }
> > @@ -1370,7 +1370,7 @@ struct audit_buffer *audit_log_start(struct
> > audit_context *ctx, gfp_t gfp_mask, int type)
> >  {
> >  	struct audit_buffer	*ab	= NULL;
> > -	struct timespec		t;
> > +	struct timespec64	t;
> >  	unsigned int		uninitialized_var(serial);
> >  	int reserve = 5; /* Allow atomic callers to go up to five
> >  			    entries over the normal backlog limit */
> > @@ -1422,8 +1422,8 @@ struct audit_buffer *audit_log_start(struct
> > audit_context *ctx, gfp_t gfp_mask,
> > 
> >  	audit_get_stamp(ab->ctx, &t, &serial);
> > 
> > -	audit_log_format(ab, "audit(%lu.%03lu:%u): ",
> > -			 t.tv_sec, t.tv_nsec/1000000, serial);
> > +	audit_log_format(ab, "audit(%llu.%03lu:%u): ",
> > +			 (unsigned long long)t.tv_sec, t.tv_nsec/1000000, serial);
> >  	return ab;
> >  }
> > 
> > diff --git a/kernel/audit.h b/kernel/audit.h
> > index cbbe6bb..029d674 100644
> > --- a/kernel/audit.h
> > +++ b/kernel/audit.h
> > @@ -111,7 +111,7 @@ struct audit_context {
> >  	enum audit_state    state, current_state;
> >  	unsigned int	    serial;     /* serial number for record */
> >  	int		    major;      /* syscall number */
> > -	struct timespec	    ctime;      /* time of syscall entry */
> > +	struct timespec64   ctime;      /* time of syscall entry */
> >  	unsigned long	    argv[4];    /* syscall arguments */
> >  	long		    return_code;/* syscall return code */
> >  	u64		    prio;
> > diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> > index 62ab53d..ecebb3c 100644
> > --- a/kernel/auditsc.c
> > +++ b/kernel/auditsc.c
> > @@ -1523,7 +1523,7 @@ void __audit_syscall_entry(int major, unsigned long
> > a1, unsigned long a2, return;
> > 
> >  	context->serial     = 0;
> > -	context->ctime      = CURRENT_TIME;
> > +	ktime_get_real_ts64(&context->ctime);
> >  	context->in_syscall = 1;
> >  	context->current_state  = state;
> >  	context->ppid       = 0;
> > @@ -1932,13 +1932,13 @@ EXPORT_SYMBOL_GPL(__audit_inode_child);
> >  /**
> >   * auditsc_get_stamp - get local copies of audit_context values
> >   * @ctx: audit_context for the task
> > - * @t: timespec to store time recorded in the audit_context
> > + * @t: timespec64 to store time recorded in the audit_context
> >   * @serial: serial value that is recorded in the audit_context
> >   *
> >   * Also sets the context as auditable.
> >   */
> >  int auditsc_get_stamp(struct audit_context *ctx,
> > -		       struct timespec *t, unsigned int *serial)
> > +		       struct timespec64 *t, unsigned int *serial)
> >  {
> >  	if (!ctx->in_syscall)
> >  		return 0;
> 
> --
> Linux-audit mailing list
> Linux-audit@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-audit

- RGB

--
Richard Guy Briggs <rgb@redhat.com>
Kernel Security Engineering, Base Operating Systems, Red Hat
Remote, Ottawa, Canada
Voice: +1.647.777.2635, Internal: (81) 32635

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 17/21] audit: Use timespec64 to represent audit timestamps
  2016-06-09 23:59     ` Richard Guy Briggs
@ 2016-06-10  0:19       ` Steve Grubb
  2016-06-10  1:44         ` Richard Guy Briggs
  2016-06-15 21:23       ` Paul Moore
  1 sibling, 1 reply; 54+ messages in thread
From: Steve Grubb @ 2016-06-10  0:19 UTC (permalink / raw)
  To: Richard Guy Briggs
  Cc: linux-audit, Arnd Bergmann, y2038, linux-kernel, Al Viro,
	linux-fsdevel, Thomas Gleixner, Linus Torvalds, Deepa Dinamani

On Thursday, June 09, 2016 07:59:43 PM Richard Guy Briggs wrote:
> On 16/06/09, Steve Grubb wrote:
> > On Wednesday, June 08, 2016 10:05:01 PM Deepa Dinamani wrote:
> > > struct timespec is not y2038 safe.
> > > Audit timestamps are recorded in string format into
> > > an audit buffer for a given context.
> > > These mark the entry timestamps for the syscalls.
> > > Use y2038 safe struct timespec64 to represent the times.
> > > The log strings can handle this transition as strings can
> > > hold upto 1024 characters.
> > 
> > Have you tested this with ausearch or any audit utilities? As an aside, a
> > time stamp that is up to 1024 characters long is terribly wasteful
> > considering how many events we get.
> 
> Steve,
> 
> I don't expect the size of the time stamp text to change since the
> format isn't being changed and I don't expect the date stamp text length
> to change until Y10K, but you never know what will happen in 8
> millenia...  (Who knows, maybe that damn Linux server in my basement
> will still be running then...)
> 
> Isn't the maximum message length MAX_AUDIT_MESSAGE_LENGTH (8970 octets)?

Bytes, yes. But I was thinking that if its going to get big we should consider 
switching from a base 10 representation to base 16. That would give us back a 
few bytes. We discuss this on the linux-audit list rather than the main list.

-Steve

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 17/21] audit: Use timespec64 to represent audit timestamps
  2016-06-09 14:31   ` Steve Grubb
  2016-06-09 23:59     ` Richard Guy Briggs
@ 2016-06-10  0:45     ` Deepa Dinamani
  1 sibling, 0 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-10  0:45 UTC (permalink / raw)
  To: Steve Grubb
  Cc: linux-audit, Linux FS-devel Mailing List,
	Linux Kernel Mailing List, Arnd Bergmann, y2038, Al Viro,
	Thomas Gleixner, Linus Torvalds

On Thu, Jun 9, 2016 at 7:31 AM, Steve Grubb <sgrubb@redhat.com> wrote:
> On Wednesday, June 08, 2016 10:05:01 PM Deepa Dinamani wrote:
>> Audit timestamps are recorded in string format into
>> an audit buffer for a given context.
>> These mark the entry timestamps for the syscalls.
>> Use y2038 safe struct timespec64 to represent the times.
>> The log strings can handle this transition as strings can
>> hold upto 1024 characters.
>
> Have you tested this with ausearch or any audit utilities? As an aside, a time
> stamp that is up to 1024 characters long is terribly wasteful considering how
> many events we get.

/* AUDIT_BUFSIZ is the size of the temporary buffer used for formatting
 * audit records.  Since printk uses a 1024 byte buffer, this buffer
 * should be at least that large. */
#define AUDIT_BUFSIZ 1024

The commit text is pointing out that the reserve space ensured in each
call to audit_log_vformat is already much more than is needed by this
call from audit_log_start.

Also, since struct timespec64 is already the same as struct timespec
on 64-bit systems, there is really no functional change except on
32-bit machines.

Let me know if you want me to try it out on a 32-bit system.

-Deepa

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 06/21] fs: udf: Replace CURRENT_TIME with current_fs_time()
  2016-06-09  7:41   ` Jan Kara
@ 2016-06-10  0:53     ` Deepa Dinamani
  0 siblings, 0 replies; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-10  0:53 UTC (permalink / raw)
  To: Jan Kara
  Cc: Linux FS-devel Mailing List, Linux Kernel Mailing List,
	Arnd Bergmann, Thomas Gleixner, Al Viro, Linus Torvalds, y2038,
	Jan Kara

On Thu, Jun 9, 2016 at 12:41 AM, Jan Kara <jack@suse.cz> wrote:
> On Wed 08-06-16 22:04:50, Deepa Dinamani wrote:
>> Logical Volume Integrity format is described to have the
>> same timestamp format for "Recording Date and time" as
>> the other [a,c,m]timestamps.
>> Hence using current_fs_time() instead here promises to
>> maintain the same granularity as other timestamps.
>>
> Just one nit below.
>
>> @@ -2030,7 +2030,7 @@ static void udf_close_lvid(struct super_block *sb)
>> -     udf_time_to_disk_stamp(&lvid->recordingDateAndTime, CURRENT_TIME);
>> +     udf_time_to_disk_stamp(&lvid->recordingDateAndTime, current_fs_time(sb));
>
> Please wrap this line properly so that it does not exceed 80 characters.
> Other than that feel free to add:
>
> Reviewed-by: Jan Kara <jack@suse.cz>

Thanks, I will take care of this in v2 of the patch series.
- Deepa

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 17/21] audit: Use timespec64 to represent audit timestamps
  2016-06-10  0:19       ` Steve Grubb
@ 2016-06-10  1:44         ` Richard Guy Briggs
  0 siblings, 0 replies; 54+ messages in thread
From: Richard Guy Briggs @ 2016-06-10  1:44 UTC (permalink / raw)
  To: Steve Grubb
  Cc: Arnd Bergmann, y2038, linux-kernel, linux-audit, Al Viro,
	linux-fsdevel, Thomas Gleixner, Linus Torvalds, Deepa Dinamani

On 16/06/09, Steve Grubb wrote:
> On Thursday, June 09, 2016 07:59:43 PM Richard Guy Briggs wrote:
> > On 16/06/09, Steve Grubb wrote:
> > > On Wednesday, June 08, 2016 10:05:01 PM Deepa Dinamani wrote:
> > > > struct timespec is not y2038 safe.
> > > > Audit timestamps are recorded in string format into
> > > > an audit buffer for a given context.
> > > > These mark the entry timestamps for the syscalls.
> > > > Use y2038 safe struct timespec64 to represent the times.
> > > > The log strings can handle this transition as strings can
> > > > hold upto 1024 characters.
> > > 
> > > Have you tested this with ausearch or any audit utilities? As an aside, a
> > > time stamp that is up to 1024 characters long is terribly wasteful
> > > considering how many events we get.
> > 
> > Steve,
> > 
> > I don't expect the size of the time stamp text to change since the
> > format isn't being changed and I don't expect the date stamp text length
> > to change until Y10K, but you never know what will happen in 8
> > millenia...  (Who knows, maybe that damn Linux server in my basement
> > will still be running then...)
> > 
> > Isn't the maximum message length MAX_AUDIT_MESSAGE_LENGTH (8970 octets)?
> 
> Bytes, yes. But I was thinking that if its going to get big we should consider 
> switching from a base 10 representation to base 16. That would give us back a 
> few bytes. We discuss this on the linux-audit list rather than the main list.

This seems like a false economy to me.  If I understand correctly, it
will be 285 years before we roll the next text digit.  The next binary
digit in the internal kernel format is in 22 years.

I know there have been discussions about changing to a binary format,
which seems to have a lot more to offer than breaking the current format
for a few bytes.

Is this not the linux-audit main list?  Is there another one I am
missing?

> -Steve

- RGB

--
Richard Guy Briggs <rgb@redhat.com>
Kernel Security Engineering, Base Operating Systems, Red Hat
Remote, Ottawa, Canada
Voice: +1.647.777.2635, Internal: (81) 32635

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 18/21] fs: nfs: Make nfs boot time y2038 safe
  2016-06-09 21:10     ` Deepa Dinamani
@ 2016-06-10 13:12       ` Anna Schumaker
  2016-06-10 14:02         ` Trond Myklebust
  0 siblings, 1 reply; 54+ messages in thread
From: Anna Schumaker @ 2016-06-10 13:12 UTC (permalink / raw)
  To: Deepa Dinamani, Trond Myklebust
  Cc: linux-fsdevel, linux-kernel, Arnd Bergmann, Thomas Gleixner,
	Al Viro, Linus Torvalds, y2038, linux-nfs

On 06/09/2016 05:10 PM, Deepa Dinamani wrote:
>>> boot_time is represented as a struct timespec.
>>> struct timespec and CURRENT_TIME are not y2038 safe.
>>> Overall, the plan is to use timespec64 for all internal
>>> kernel representation of timestamps.
>>> CURRENT_TIME will also be removed.
>>> Use struct timespec64 to represent boot_time.
>>> And, ktime_get_real_ts64() for the boot_time value.
>>>
>>> boot_time is used to construct the nfs client boot verifier.
>>> This will now wrap in 2106 instead of 2038 on 32-bit systems.
>>> The server only relies on the value being persistent until
>>> reboot so the wrapping should be fine.
>>
>> We really do not give a damn about wraparound here, since the boot time is
>> only ever compared for an exact match, and the odds of two reboots occurring
>> exactly 2^32 * 10^9 nanoseconds apart are cosmically small...
>> If struct timespec is going away, can we just convert this into a ktime_t?
> 
> timespec64 is the same as timespec already on 64 bit machines.
> But, yes, we can use ktime_t here.
> 
> Did you mean the internal storage value or the wire boo_time used for verifier?
> In case you don't want to change the wire value, then we will have a division
> operation, every time the verifier needs to be sent.

The verifier is mostly used during mounting, so we don't send too many of them.  I don't think we need to worry about adding an extra division operation here, they're pretty cheap compared to making RPC calls! :)

Anna

> 
> -Deepa
> 
> -Deepa
> 

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 18/21] fs: nfs: Make nfs boot time y2038 safe
  2016-06-10 13:12       ` Anna Schumaker
@ 2016-06-10 14:02         ` Trond Myklebust
  0 siblings, 0 replies; 54+ messages in thread
From: Trond Myklebust @ 2016-06-10 14:02 UTC (permalink / raw)
  To: Anna Schumaker, Deepa Dinamani
  Cc: linux-fsdevel, linux-kernel, Arnd Bergmann, Thomas Gleixner,
	Al Viro, Linus Torvalds, y2038, linux-nfs



On 6/10/16, 09:12, "Anna Schumaker" <Anna.Schumaker@netapp.com> wrote:

>On 06/09/2016 05:10 PM, Deepa Dinamani wrote:
>>>> boot_time is represented as a struct timespec.
>>>> struct timespec and CURRENT_TIME are not y2038 safe.
>>>> Overall, the plan is to use timespec64 for all internal
>>>> kernel representation of timestamps.
>>>> CURRENT_TIME will also be removed.
>>>> Use struct timespec64 to represent boot_time.
>>>> And, ktime_get_real_ts64() for the boot_time value.
>>>>
>>>> boot_time is used to construct the nfs client boot verifier.
>>>> This will now wrap in 2106 instead of 2038 on 32-bit systems.
>>>> The server only relies on the value being persistent until
>>>> reboot so the wrapping should be fine.
>>>
>>> We really do not give a damn about wraparound here, since the boot time is
>>> only ever compared for an exact match, and the odds of two reboots occurring
>>> exactly 2^32 * 10^9 nanoseconds apart are cosmically small...
>>> If struct timespec is going away, can we just convert this into a ktime_t?
>> 
>> timespec64 is the same as timespec already on 64 bit machines.
>> But, yes, we can use ktime_t here.
>> 
>> Did you mean the internal storage value or the wire boo_time used for verifier?
>> In case you don't want to change the wire value, then we will have a division
>> operation, every time the verifier needs to be sent.
>
>The verifier is mostly used during mounting, so we don't send too many of them.  I don't think we need to worry about adding an extra division operation here, they're pretty cheap compared to making RPC calls! :)
>

The only requirement for the verifier is that it be unique, so changing the format is not a problem either. 

Cheers
  Trond

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [Y2038] [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps
  2016-06-09 18:45   ` Linus Torvalds
  2016-06-09 18:55     ` Linus Torvalds
@ 2016-06-10 22:19     ` Arnd Bergmann
  2016-06-14 17:55       ` Deepa Dinamani
  1 sibling, 1 reply; 54+ messages in thread
From: Arnd Bergmann @ 2016-06-10 22:19 UTC (permalink / raw)
  To: y2038
  Cc: Linus Torvalds, Deepa Dinamani, Theodore Ts'o,
	Linux Kernel Mailing List, Andreas Dilger, Al Viro,
	linux-fsdevel, Thomas Gleixner, linux-ext4

On Thursday, June 9, 2016 11:45:01 AM CEST Linus Torvalds wrote:
> On Wed, Jun 8, 2016 at 10:04 PM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> > CURRENT_TIME_SEC and CURRENT_TIME are not y2038 safe.
> > current_fs_time() will be transitioned to be y2038 safe
> > along with vfs.
> >
> > current_fs_time() returns timestamps according to the
> > granularities set in the super_block.
> 
> All existing users and all the ones in this patch (and the others too,
> although I didn't go through them very carefully) really would prefer
> just passing in the inode directly, rather than the superblock.
> 
> So I don't want to add more users of this broken interface.  It was a
> mistake to use the superblock. The fact that the time granularity
> exists there is pretty much irrelevant. If every single user wants to
> use an inode pointer, then that is what the function should get.

I guess it would help to give the function a new name in the process,
if only to avoid possible conflicts. That new name of course needs to
be at least as intuitive as the old one. How about

struct timespec fs_timestamp(struct inode *);

? 

	Arnd

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()
  2016-06-09  5:04 ` [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time() Deepa Dinamani
  2016-06-09  7:35   ` Jan Kara
  2016-06-09 12:31   ` Bob Copeland
@ 2016-06-10 22:21   ` Arnd Bergmann
  2016-06-11  5:03     ` Deepa Dinamani
  2 siblings, 1 reply; 54+ messages in thread
From: Arnd Bergmann @ 2016-06-10 22:21 UTC (permalink / raw)
  To: Deepa Dinamani, Bob Copeland
  Cc: linux-fsdevel, linux-kernel, Thomas Gleixner, Al Viro,
	Linus Torvalds, y2038, Artem Bityutskiy, Adrian Hunter,
	linux-mtd, Evgeniy Dushistov, OGAWA Hirofumi, Jan Kara,
	linux-ext4, David Howells, linux-afs, Tigran A. Aivazian,
	Theodore Ts'o, Andreas Dilger, Jan Kara, Jan Harkes, coda,
	linux-karma-devel, Christoph Hellwig

On Wednesday, June 8, 2016 10:04:45 PM CEST Deepa Dinamani wrote:
> CURRENT_TIME_SEC is not y2038 safe. current_fs_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_fs_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.
> 
> Also note that filesystem specific times like the birthtime,
> creation time that were using same interfaces to obtain time
> retain same logistics.
> 
> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>

one question:

In an earlier version, you had a small optimization to
use ktime_get_real_seconds() instead of current_kernel_time()
when the granularity is seconds.

Do you still plan to send that one, or did you decide we don't
need it?

	Arnd

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [lustre-devel] [PATCH 11/21] drivers: staging: lustre: Replace CURRENT_TIME with current_fs_time()
  2016-06-09  5:04 ` [PATCH 11/21] drivers: staging: lustre: Replace CURRENT_TIME with current_fs_time() Deepa Dinamani
@ 2016-06-11  0:36   ` James Simmons
  2016-06-11  1:53     ` Andreas Dilger
  0 siblings, 1 reply; 54+ messages in thread
From: James Simmons @ 2016-06-11  0:36 UTC (permalink / raw)
  To: Deepa Dinamani
  Cc: linux-fsdevel, linux-kernel, Arnd Bergmann, y2038,
	Greg Kroah-Hartman, Al Viro, Thomas Gleixner, Linus Torvalds,
	lustre-devel


> CURRENT_TIME macro is not appropriate for filesystems as it
> doesn't use the right granularity for filesystem timestamps.
> Use current_fs_time() instead.
> 
> This is also in preparation for the patch that transitions
> vfs timestamps to use 64 bit time and hence make them
> y2038 safe. As part of the effort current_fs_time() will be
> extended to do range checks. Hence, it is necessary for all
> file system timestamps to use current_fs_time().
> 
> Also change format string for prints so that these are valid
> when vfs is transitioned to use 64 bit timestamps.

Acked-by: James Simmons <jsimmons@infradead.org>
 
> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: lustre-devel@lists.lustre.org
> ---
>  drivers/staging/lustre/lustre/llite/llite_lib.c         | 17 +++++++++--------
>  drivers/staging/lustre/lustre/llite/namei.c             |  4 ++--
>  drivers/staging/lustre/lustre/mdc/mdc_reint.c           |  6 +++---
>  .../staging/lustre/lustre/obdclass/linux/linux-obdo.c   |  6 +++---
>  drivers/staging/lustre/lustre/obdclass/obdo.c           |  6 +++---
>  drivers/staging/lustre/lustre/osc/osc_io.c              |  2 +-
>  6 files changed, 21 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
> index 96c7e9f..919748f 100644
> --- a/drivers/staging/lustre/lustre/llite/llite_lib.c
> +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
> @@ -1219,6 +1219,7 @@ static int ll_setattr_done_writing(struct inode *inode,
>  int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
>  {
>  	struct inode *inode = d_inode(dentry);
> +	struct super_block *sb = inode->i_sb;
>  	struct ll_inode_info *lli = ll_i2info(inode);
>  	struct md_op_data *op_data = NULL;
>  	struct md_open_data *mod = NULL;
> @@ -1258,23 +1259,23 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
>  
>  	/* We mark all of the fields "set" so MDS/OST does not re-set them */
>  	if (attr->ia_valid & ATTR_CTIME) {
> -		attr->ia_ctime = CURRENT_TIME;
> +		attr->ia_ctime = current_fs_time(sb);
>  		attr->ia_valid |= ATTR_CTIME_SET;
>  	}
>  	if (!(attr->ia_valid & ATTR_ATIME_SET) &&
>  	    (attr->ia_valid & ATTR_ATIME)) {
> -		attr->ia_atime = CURRENT_TIME;
> +		attr->ia_atime = current_fs_time(sb);
>  		attr->ia_valid |= ATTR_ATIME_SET;
>  	}
>  	if (!(attr->ia_valid & ATTR_MTIME_SET) &&
>  	    (attr->ia_valid & ATTR_MTIME)) {
> -		attr->ia_mtime = CURRENT_TIME;
> +		attr->ia_mtime = current_fs_time(sb);
>  		attr->ia_valid |= ATTR_MTIME_SET;
>  	}
>  
>  	if (attr->ia_valid & (ATTR_MTIME | ATTR_CTIME))
> -		CDEBUG(D_INODE, "setting mtime %lu, ctime %lu, now = %llu\n",
> -		       LTIME_S(attr->ia_mtime), LTIME_S(attr->ia_ctime),
> +		CDEBUG(D_INODE, "setting mtime %llu, ctime %llu, now = %llu\n",
> +		       (long long)LTIME_S(attr->ia_mtime), (long long)LTIME_S(attr->ia_ctime),
>  		       (s64)ktime_get_real_seconds());
>  
>  	/* We always do an MDS RPC, even if we're only changing the size;
> @@ -1564,9 +1565,9 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
>  	}
>  	if (body->valid & OBD_MD_FLMTIME) {
>  		if (body->mtime > LTIME_S(inode->i_mtime)) {
> -			CDEBUG(D_INODE, "setting ino %lu mtime from %lu to %llu\n",
> -			       inode->i_ino, LTIME_S(inode->i_mtime),
> -			       body->mtime);
> +			CDEBUG(D_INODE, "setting ino %lu mtime from %llu to %llu\n",
> +			       inode->i_ino, (unsigned long long)LTIME_S(inode->i_mtime),
> +			       (unsigned long long)body->mtime);
>  			LTIME_S(inode->i_mtime) = body->mtime;
>  		}
>  		lli->lli_mtime = body->mtime;
> diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c
> index 5eba0eb..48ed1ce 100644
> --- a/drivers/staging/lustre/lustre/llite/namei.c
> +++ b/drivers/staging/lustre/lustre/llite/namei.c
> @@ -731,8 +731,8 @@ static void ll_update_times(struct ptlrpc_request *request,
>  	LASSERT(body);
>  	if (body->valid & OBD_MD_FLMTIME &&
>  	    body->mtime > LTIME_S(inode->i_mtime)) {
> -		CDEBUG(D_INODE, "setting fid "DFID" mtime from %lu to %llu\n",
> -		       PFID(ll_inode2fid(inode)), LTIME_S(inode->i_mtime),
> +		CDEBUG(D_INODE, "setting fid "DFID" mtime from %llu to %llu\n",
> +		       PFID(ll_inode2fid(inode)), (unsigned long long)LTIME_S(inode->i_mtime),
>  		       body->mtime);
>  		LTIME_S(inode->i_mtime) = body->mtime;
>  	}
> diff --git a/drivers/staging/lustre/lustre/mdc/mdc_reint.c b/drivers/staging/lustre/lustre/mdc/mdc_reint.c
> index 4ef3db1..9980f3a 100644
> --- a/drivers/staging/lustre/lustre/mdc/mdc_reint.c
> +++ b/drivers/staging/lustre/lustre/mdc/mdc_reint.c
> @@ -143,9 +143,9 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
>  	rpc_lock = obd->u.cli.cl_rpc_lock;
>  
>  	if (op_data->op_attr.ia_valid & (ATTR_MTIME | ATTR_CTIME))
> -		CDEBUG(D_INODE, "setting mtime %ld, ctime %ld\n",
> -		       LTIME_S(op_data->op_attr.ia_mtime),
> -		       LTIME_S(op_data->op_attr.ia_ctime));
> +		CDEBUG(D_INODE, "setting mtime %lld, ctime %lld\n",
> +		       (long long)LTIME_S(op_data->op_attr.ia_mtime),
> +		       (long long)LTIME_S(op_data->op_attr.ia_ctime));
>  	mdc_setattr_pack(req, op_data, ea, ealen, ea2, ea2len);
>  
>  	ptlrpc_request_set_replen(req);
> diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
> index b41b65e..ccd2b7b 100644
> --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
> +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
> @@ -54,9 +54,9 @@ void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid)
>  
>  	if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
>  		CDEBUG(D_INODE,
> -		       "valid %#llx, cur time %lu/%lu, new %llu/%llu\n",
> -		       src->o_valid, LTIME_S(dst->i_mtime),
> -		       LTIME_S(dst->i_ctime), src->o_mtime, src->o_ctime);
> +		       "valid %#llx, cur time %llu/%llu, new %llu/%llu\n",
> +		       src->o_valid, (unsigned long long)LTIME_S(dst->i_mtime),
> +		       (unsigned long long)LTIME_S(dst->i_ctime), src->o_mtime, src->o_ctime);
>  
>  	if (valid & OBD_MD_FLATIME && src->o_atime > LTIME_S(dst->i_atime))
>  		LTIME_S(dst->i_atime) = src->o_atime;
> diff --git a/drivers/staging/lustre/lustre/obdclass/obdo.c b/drivers/staging/lustre/lustre/obdclass/obdo.c
> index 748e33f..973fa4c 100644
> --- a/drivers/staging/lustre/lustre/obdclass/obdo.c
> +++ b/drivers/staging/lustre/lustre/obdclass/obdo.c
> @@ -62,9 +62,9 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid)
>  	u32 newvalid = 0;
>  
>  	if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
> -		CDEBUG(D_INODE, "valid %x, new time %lu/%lu\n",
> -		       valid, LTIME_S(src->i_mtime),
> -		       LTIME_S(src->i_ctime));
> +		CDEBUG(D_INODE, "valid %x, new time %llu/%llu\n",
> +		       valid, (unsigned long long)LTIME_S(src->i_mtime),
> +		       (unsigned long long)LTIME_S(src->i_ctime));
>  
>  	if (valid & OBD_MD_FLATIME) {
>  		dst->o_atime = LTIME_S(src->i_atime);
> diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c
> index d534b0e..99f69bb 100644
> --- a/drivers/staging/lustre/lustre/osc/osc_io.c
> +++ b/drivers/staging/lustre/lustre/osc/osc_io.c
> @@ -221,7 +221,7 @@ static void osc_page_touch_at(const struct lu_env *env,
>  	       kms > loi->loi_kms ? "" : "not ", loi->loi_kms, kms,
>  	       loi->loi_lvb.lvb_size);
>  
> -	attr->cat_mtime = attr->cat_ctime = LTIME_S(CURRENT_TIME);
> +	attr->cat_mtime = attr->cat_ctime = ktime_get_real_seconds();
>  	valid = CAT_MTIME | CAT_CTIME;
>  	if (kms > loi->loi_kms) {
>  		attr->cat_kms = kms;
> -- 
> 1.9.1
> 
> _______________________________________________
> lustre-devel mailing list
> lustre-devel@lists.lustre.org
> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
> 

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [lustre-devel] [PATCH 11/21] drivers: staging: lustre: Replace CURRENT_TIME with current_fs_time()
  2016-06-11  0:36   ` [lustre-devel] " James Simmons
@ 2016-06-11  1:53     ` Andreas Dilger
  0 siblings, 0 replies; 54+ messages in thread
From: Andreas Dilger @ 2016-06-11  1:53 UTC (permalink / raw)
  To: James Simmons
  Cc: Deepa Dinamani, linux-fsdevel, linux-kernel, Arnd Bergmann,
	y2038, Greg Kroah-Hartman, Al Viro, Thomas Gleixner,
	Linus Torvalds, lustre-devel

[-- Attachment #1: Type: text/plain, Size: 8696 bytes --]

On Jun 10, 2016, at 6:36 PM, James Simmons <jsimmons@infradead.org> wrote:
> 
> 
>> CURRENT_TIME macro is not appropriate for filesystems as it
>> doesn't use the right granularity for filesystem timestamps.
>> Use current_fs_time() instead.
>> 
>> This is also in preparation for the patch that transitions
>> vfs timestamps to use 64 bit time and hence make them
>> y2038 safe. As part of the effort current_fs_time() will be
>> extended to do range checks. Hence, it is necessary for all
>> file system timestamps to use current_fs_time().
>> 
>> Also change format string for prints so that these are valid
>> when vfs is transitioned to use 64 bit timestamps.
> 
> Acked-by: James Simmons <jsimmons@infradead.org>

Actually, Linus NAK'd the base patch so there isn't any point in this
one landing.

Cheers, Andreas

>> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> Cc: lustre-devel@lists.lustre.org
>> ---
>> drivers/staging/lustre/lustre/llite/llite_lib.c         | 17 +++++++++--------
>> drivers/staging/lustre/lustre/llite/namei.c             |  4 ++--
>> drivers/staging/lustre/lustre/mdc/mdc_reint.c           |  6 +++---
>> .../staging/lustre/lustre/obdclass/linux/linux-obdo.c   |  6 +++---
>> drivers/staging/lustre/lustre/obdclass/obdo.c           |  6 +++---
>> drivers/staging/lustre/lustre/osc/osc_io.c              |  2 +-
>> 6 files changed, 21 insertions(+), 20 deletions(-)
>> 
>> diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
>> index 96c7e9f..919748f 100644
>> --- a/drivers/staging/lustre/lustre/llite/llite_lib.c
>> +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
>> @@ -1219,6 +1219,7 @@ static int ll_setattr_done_writing(struct inode *inode,
>> int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
>> {
>> 	struct inode *inode = d_inode(dentry);
>> +	struct super_block *sb = inode->i_sb;
>> 	struct ll_inode_info *lli = ll_i2info(inode);
>> 	struct md_op_data *op_data = NULL;
>> 	struct md_open_data *mod = NULL;
>> @@ -1258,23 +1259,23 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
>> 
>> 	/* We mark all of the fields "set" so MDS/OST does not re-set them */
>> 	if (attr->ia_valid & ATTR_CTIME) {
>> -		attr->ia_ctime = CURRENT_TIME;
>> +		attr->ia_ctime = current_fs_time(sb);
>> 		attr->ia_valid |= ATTR_CTIME_SET;
>> 	}
>> 	if (!(attr->ia_valid & ATTR_ATIME_SET) &&
>> 	    (attr->ia_valid & ATTR_ATIME)) {
>> -		attr->ia_atime = CURRENT_TIME;
>> +		attr->ia_atime = current_fs_time(sb);
>> 		attr->ia_valid |= ATTR_ATIME_SET;
>> 	}
>> 	if (!(attr->ia_valid & ATTR_MTIME_SET) &&
>> 	    (attr->ia_valid & ATTR_MTIME)) {
>> -		attr->ia_mtime = CURRENT_TIME;
>> +		attr->ia_mtime = current_fs_time(sb);
>> 		attr->ia_valid |= ATTR_MTIME_SET;
>> 	}
>> 
>> 	if (attr->ia_valid & (ATTR_MTIME | ATTR_CTIME))
>> -		CDEBUG(D_INODE, "setting mtime %lu, ctime %lu, now = %llu\n",
>> -		       LTIME_S(attr->ia_mtime), LTIME_S(attr->ia_ctime),
>> +		CDEBUG(D_INODE, "setting mtime %llu, ctime %llu, now = %llu\n",
>> +		       (long long)LTIME_S(attr->ia_mtime), (long long)LTIME_S(attr->ia_ctime),
>> 		       (s64)ktime_get_real_seconds());
>> 
>> 	/* We always do an MDS RPC, even if we're only changing the size;
>> @@ -1564,9 +1565,9 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
>> 	}
>> 	if (body->valid & OBD_MD_FLMTIME) {
>> 		if (body->mtime > LTIME_S(inode->i_mtime)) {
>> -			CDEBUG(D_INODE, "setting ino %lu mtime from %lu to %llu\n",
>> -			       inode->i_ino, LTIME_S(inode->i_mtime),
>> -			       body->mtime);
>> +			CDEBUG(D_INODE, "setting ino %lu mtime from %llu to %llu\n",
>> +			       inode->i_ino, (unsigned long long)LTIME_S(inode->i_mtime),
>> +			       (unsigned long long)body->mtime);
>> 			LTIME_S(inode->i_mtime) = body->mtime;
>> 		}
>> 		lli->lli_mtime = body->mtime;
>> diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c
>> index 5eba0eb..48ed1ce 100644
>> --- a/drivers/staging/lustre/lustre/llite/namei.c
>> +++ b/drivers/staging/lustre/lustre/llite/namei.c
>> @@ -731,8 +731,8 @@ static void ll_update_times(struct ptlrpc_request *request,
>> 	LASSERT(body);
>> 	if (body->valid & OBD_MD_FLMTIME &&
>> 	    body->mtime > LTIME_S(inode->i_mtime)) {
>> -		CDEBUG(D_INODE, "setting fid "DFID" mtime from %lu to %llu\n",
>> -		       PFID(ll_inode2fid(inode)), LTIME_S(inode->i_mtime),
>> +		CDEBUG(D_INODE, "setting fid "DFID" mtime from %llu to %llu\n",
>> +		       PFID(ll_inode2fid(inode)), (unsigned long long)LTIME_S(inode->i_mtime),
>> 		       body->mtime);
>> 		LTIME_S(inode->i_mtime) = body->mtime;
>> 	}
>> diff --git a/drivers/staging/lustre/lustre/mdc/mdc_reint.c b/drivers/staging/lustre/lustre/mdc/mdc_reint.c
>> index 4ef3db1..9980f3a 100644
>> --- a/drivers/staging/lustre/lustre/mdc/mdc_reint.c
>> +++ b/drivers/staging/lustre/lustre/mdc/mdc_reint.c
>> @@ -143,9 +143,9 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
>> 	rpc_lock = obd->u.cli.cl_rpc_lock;
>> 
>> 	if (op_data->op_attr.ia_valid & (ATTR_MTIME | ATTR_CTIME))
>> -		CDEBUG(D_INODE, "setting mtime %ld, ctime %ld\n",
>> -		       LTIME_S(op_data->op_attr.ia_mtime),
>> -		       LTIME_S(op_data->op_attr.ia_ctime));
>> +		CDEBUG(D_INODE, "setting mtime %lld, ctime %lld\n",
>> +		       (long long)LTIME_S(op_data->op_attr.ia_mtime),
>> +		       (long long)LTIME_S(op_data->op_attr.ia_ctime));
>> 	mdc_setattr_pack(req, op_data, ea, ealen, ea2, ea2len);
>> 
>> 	ptlrpc_request_set_replen(req);
>> diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
>> index b41b65e..ccd2b7b 100644
>> --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
>> +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
>> @@ -54,9 +54,9 @@ void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid)
>> 
>> 	if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
>> 		CDEBUG(D_INODE,
>> -		       "valid %#llx, cur time %lu/%lu, new %llu/%llu\n",
>> -		       src->o_valid, LTIME_S(dst->i_mtime),
>> -		       LTIME_S(dst->i_ctime), src->o_mtime, src->o_ctime);
>> +		       "valid %#llx, cur time %llu/%llu, new %llu/%llu\n",
>> +		       src->o_valid, (unsigned long long)LTIME_S(dst->i_mtime),
>> +		       (unsigned long long)LTIME_S(dst->i_ctime), src->o_mtime, src->o_ctime);
>> 
>> 	if (valid & OBD_MD_FLATIME && src->o_atime > LTIME_S(dst->i_atime))
>> 		LTIME_S(dst->i_atime) = src->o_atime;
>> diff --git a/drivers/staging/lustre/lustre/obdclass/obdo.c b/drivers/staging/lustre/lustre/obdclass/obdo.c
>> index 748e33f..973fa4c 100644
>> --- a/drivers/staging/lustre/lustre/obdclass/obdo.c
>> +++ b/drivers/staging/lustre/lustre/obdclass/obdo.c
>> @@ -62,9 +62,9 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid)
>> 	u32 newvalid = 0;
>> 
>> 	if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
>> -		CDEBUG(D_INODE, "valid %x, new time %lu/%lu\n",
>> -		       valid, LTIME_S(src->i_mtime),
>> -		       LTIME_S(src->i_ctime));
>> +		CDEBUG(D_INODE, "valid %x, new time %llu/%llu\n",
>> +		       valid, (unsigned long long)LTIME_S(src->i_mtime),
>> +		       (unsigned long long)LTIME_S(src->i_ctime));
>> 
>> 	if (valid & OBD_MD_FLATIME) {
>> 		dst->o_atime = LTIME_S(src->i_atime);
>> diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c
>> index d534b0e..99f69bb 100644
>> --- a/drivers/staging/lustre/lustre/osc/osc_io.c
>> +++ b/drivers/staging/lustre/lustre/osc/osc_io.c
>> @@ -221,7 +221,7 @@ static void osc_page_touch_at(const struct lu_env *env,
>> 	       kms > loi->loi_kms ? "" : "not ", loi->loi_kms, kms,
>> 	       loi->loi_lvb.lvb_size);
>> 
>> -	attr->cat_mtime = attr->cat_ctime = LTIME_S(CURRENT_TIME);
>> +	attr->cat_mtime = attr->cat_ctime = ktime_get_real_seconds();
>> 	valid = CAT_MTIME | CAT_CTIME;
>> 	if (kms > loi->loi_kms) {
>> 		attr->cat_kms = kms;
>> --
>> 1.9.1
>> 
>> _______________________________________________
>> lustre-devel mailing list
>> lustre-devel@lists.lustre.org
>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
>> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cheers, Andreas






[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()
  2016-06-10 22:21   ` Arnd Bergmann
@ 2016-06-11  5:03     ` Deepa Dinamani
  2016-06-11 20:55       ` Arnd Bergmann
  0 siblings, 1 reply; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-11  5:03 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Bob Copeland, Linux FS-devel Mailing List,
	Linux Kernel Mailing List, Thomas Gleixner, Al Viro,
	Linus Torvalds, y2038, Artem Bityutskiy, Adrian Hunter,
	linux-mtd, Evgeniy Dushistov, OGAWA Hirofumi, Jan Kara,
	linux-ext4, David Howells, linux-afs, Tigran A. Aivazian,
	Theodore Ts'o, Andreas Dilger, Jan Kara, Jan Harkes, coda,
	linux-karma-devel, Christoph Hellwig

On Fri, Jun 10, 2016 at 3:21 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Wednesday, June 8, 2016 10:04:45 PM CEST Deepa Dinamani wrote:
>> CURRENT_TIME_SEC is not y2038 safe. current_fs_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_fs_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.
>>
>> Also note that filesystem specific times like the birthtime,
>> creation time that were using same interfaces to obtain time
>> retain same logistics.
>>
>> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
>
> one question:
>
> In an earlier version, you had a small optimization to
> use ktime_get_real_seconds() instead of current_kernel_time()
> when the granularity is seconds.
>
> Do you still plan to send that one, or did you decide we don't
> need it?

I was actually planning to use get_seconds() instead of current_kernel_time().
And, transition both along with vfs to y2038 safe apis.
Difference between ktime_get_real_seconds() and current_kernel_time64()
is not much because they both require sequence counter.

It didn't make sense to me to optimize current_fs_time() for seconds
only, and not optimize for 1ns granularity also.
I plan to make changes to the function depending on how we end up
using timespec_trunc()
after the addition of range checking.

Thanks for the guidance on inclusion of reviewers. I'll follow this
approach when I post v2 of the series.

-Deepa

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()
  2016-06-11  5:03     ` Deepa Dinamani
@ 2016-06-11 20:55       ` Arnd Bergmann
  0 siblings, 0 replies; 54+ messages in thread
From: Arnd Bergmann @ 2016-06-11 20:55 UTC (permalink / raw)
  To: Deepa Dinamani
  Cc: Bob Copeland, Linux FS-devel Mailing List,
	Linux Kernel Mailing List, Thomas Gleixner, Al Viro,
	Linus Torvalds, y2038, Artem Bityutskiy, Adrian Hunter,
	linux-mtd, Evgeniy Dushistov, OGAWA Hirofumi, Jan Kara,
	linux-ext4, David Howells, linux-afs, Tigran A. Aivazian,
	Theodore Ts'o, Andreas Dilger, Jan Kara, Jan Harkes, coda,
	linux-karma-devel, Christoph Hellwig

On Friday, June 10, 2016 10:03:14 PM CEST Deepa Dinamani wrote:
> On Fri, Jun 10, 2016 at 3:21 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> >
> > In an earlier version, you had a small optimization to
> > use ktime_get_real_seconds() instead of current_kernel_time()
> > when the granularity is seconds.
> >
> > Do you still plan to send that one, or did you decide we don't
> > need it?
> 
> I was actually planning to use get_seconds() instead of current_kernel_time().
> And, transition both along with vfs to y2038 safe apis.
> Difference between ktime_get_real_seconds() and current_kernel_time64()
> is not much because they both require sequence counter.
> 
> It didn't make sense to me to optimize current_fs_time() for seconds
> only, and not optimize for 1ns granularity also.

Ah, you are right: adding another check for second granularity would
probably cost more than it would save, since we already don't calculate
the exact nanoseconds but just use the timestamp of the last timer
tick.

> I plan to make changes to the function depending on how we end up
> using timespec_trunc() after the addition of range checking.

Makes sense. I guess we can skip the range checking for
current_fs_time() if we end up not allowing writable mounts on
file systems that cannot represent the current time, but we
do want the range checking for the other users of
timespec_trunc().

	Arnd

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [Y2038] [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps
  2016-06-10 22:19     ` [Y2038] " Arnd Bergmann
@ 2016-06-14 17:55       ` Deepa Dinamani
  2016-06-14 20:59         ` Arnd Bergmann
  0 siblings, 1 reply; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-14 17:55 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: y2038, Linus Torvalds, Theodore Ts'o,
	Linux Kernel Mailing List, Andreas Dilger, Al Viro,
	linux-fsdevel, Thomas Gleixner, linux-ext4

On Fri, Jun 10, 2016 at 3:19 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Thursday, June 9, 2016 11:45:01 AM CEST Linus Torvalds wrote:
>> On Wed, Jun 8, 2016 at 10:04 PM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
>> > CURRENT_TIME_SEC and CURRENT_TIME are not y2038 safe.
>> > current_fs_time() will be transitioned to be y2038 safe
>> > along with vfs.
>> >
>> > current_fs_time() returns timestamps according to the
>> > granularities set in the super_block.
>>
>> All existing users and all the ones in this patch (and the others too,
>> although I didn't go through them very carefully) really would prefer
>> just passing in the inode directly, rather than the superblock.
>>
>> So I don't want to add more users of this broken interface.  It was a
>> mistake to use the superblock. The fact that the time granularity
>> exists there is pretty much irrelevant. If every single user wants to
>> use an inode pointer, then that is what the function should get.
>
> I guess it would help to give the function a new name in the process,
> if only to avoid possible conflicts. That new name of course needs to
> be at least as intuitive as the old one. How about
>
> struct timespec fs_timestamp(struct inode *);

Would moving the function to fs/ directory (filesystems.c/ super.c /
inode.c) and calling it current_time() or fs_current_time() make
sense?
The declaration is already part of fs.h.

This is actually a vfs function.
And, the time functions it uses are already exported.
Leaving it in the time.c by renaming to current_time() would be
confusing in spite of
the struct inode* argument.

-Deepa

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [Y2038] [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps
  2016-06-14 17:55       ` Deepa Dinamani
@ 2016-06-14 20:59         ` Arnd Bergmann
  0 siblings, 0 replies; 54+ messages in thread
From: Arnd Bergmann @ 2016-06-14 20:59 UTC (permalink / raw)
  To: Deepa Dinamani, John Stultz
  Cc: y2038, Linus Torvalds, Theodore Ts'o,
	Linux Kernel Mailing List, Andreas Dilger, Al Viro,
	linux-fsdevel, Thomas Gleixner, linux-ext4

On Tuesday, June 14, 2016 10:55:39 AM CEST Deepa Dinamani wrote:
> On Fri, Jun 10, 2016 at 3:19 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Thursday, June 9, 2016 11:45:01 AM CEST Linus Torvalds wrote:
> >> On Wed, Jun 8, 2016 at 10:04 PM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> >> > CURRENT_TIME_SEC and CURRENT_TIME are not y2038 safe.
> >> > current_fs_time() will be transitioned to be y2038 safe
> >> > along with vfs.
> >> >
> >> > current_fs_time() returns timestamps according to the
> >> > granularities set in the super_block.
> >>
> >> All existing users and all the ones in this patch (and the others too,
> >> although I didn't go through them very carefully) really would prefer
> >> just passing in the inode directly, rather than the superblock.
> >>
> >> So I don't want to add more users of this broken interface.  It was a
> >> mistake to use the superblock. The fact that the time granularity
> >> exists there is pretty much irrelevant. If every single user wants to
> >> use an inode pointer, then that is what the function should get.
> >
> > I guess it would help to give the function a new name in the process,
> > if only to avoid possible conflicts. That new name of course needs to
> > be at least as intuitive as the old one. How about
> >
> > struct timespec fs_timestamp(struct inode *);
> 
> Would moving the function to fs/ directory (filesystems.c/ super.c /
> inode.c) and calling it current_time() or fs_current_time() make
> sense?
> The declaration is already part of fs.h.
>
> This is actually a vfs function.
> And, the time functions it uses are already exported.
> Leaving it in the time.c by renaming to current_time() would be
> confusing in spite of
> the struct inode* argument.

I've looked up the original patch that introduced current_fs_time
at http://marc.info/?l=linux-kernel&m=110134111125012&w=3

>From the patch, it's clear that current_fs_time was intentionally
added to the same file as current_kernel_time() so it could be
inlined there, but both functions have since been moved to different
files.

I agree moving both timespec_trunc and current_fs_time into
fs/inode.c or fs/attr.c seems appropriate then, or we could move
current_fs_time() into kernel/time/timekeeping.c and mark
current_kernel_time64() inline again.

When John Stultz moved this function in 2c6b47de17c7 ("Cleanup
non-arch xtime uses, use get_seconds() or current_kernel_time()."),
he evidently did not consider the "inline" behavior important
there, no idea if this is even measurable.

	Arnd

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 15/21] time: Add time64_to_tm()
  2016-06-09  5:04 ` [PATCH 15/21] time: Add time64_to_tm() Deepa Dinamani
@ 2016-06-14 21:18   ` John Stultz
  2016-06-15 17:44     ` Deepa Dinamani
  0 siblings, 1 reply; 54+ messages in thread
From: John Stultz @ 2016-06-14 21:18 UTC (permalink / raw)
  To: Deepa Dinamani
  Cc: linux-fsdevel, lkml, Arnd Bergmann, Thomas Gleixner, Al Viro,
	Linus Torvalds, y2038 Mailman List

On Wed, Jun 8, 2016 at 10:04 PM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> time_to_tm() takes time_t as an argument.
> time_t is not y2038 safe.
> Add time64_to_tm() that takes time64_t as an argument
> which is y2038 safe.
> The plan is to eventually replace all calls to time_to_tm()
> by time64_to_tm().
>
> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
> Cc: John Stultz <john.stultz@linaro.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>

This looks sane to me. Are you hoping for me to queue this, or would
you like i to go though the fsdev maintainers with my ack?

In either case.

Acked-by: John Stultz <john.stultz@linaro.org>

thanks
-john

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 21/21] time: Delete CURRENT_TIME_SEC and CURRENT_TIME macro
  2016-06-09  5:05 ` [PATCH 21/21] time: Delete CURRENT_TIME_SEC and CURRENT_TIME macro Deepa Dinamani
@ 2016-06-14 21:20   ` John Stultz
  0 siblings, 0 replies; 54+ messages in thread
From: John Stultz @ 2016-06-14 21:20 UTC (permalink / raw)
  To: Deepa Dinamani
  Cc: linux-fsdevel, lkml, Arnd Bergmann, Thomas Gleixner, Al Viro,
	Linus Torvalds, y2038 Mailman List

On Wed, Jun 8, 2016 at 10:05 PM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> All uses of these macors have been replaced by other
> time functions.
> These macros are also not y2038 safe.
> And, all its usecases can be fulfilled by y2038
> safe ktime_get_* variants.
>

Assuming the prereqs are in place:

Acked-by: John Stultz <john.stultz@linaro.org>

thanks
-john

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 15/21] time: Add time64_to_tm()
  2016-06-14 21:18   ` John Stultz
@ 2016-06-15 17:44     ` Deepa Dinamani
  2016-06-17 20:52       ` John Stultz
  0 siblings, 1 reply; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-15 17:44 UTC (permalink / raw)
  To: John Stultz
  Cc: linux-fsdevel, lkml, Arnd Bergmann, Thomas Gleixner, Al Viro,
	Linus Torvalds, y2038 Mailman List

On Tue, Jun 14, 2016 at 2:18 PM, John Stultz <john.stultz@linaro.org> wrote:
> On Wed, Jun 8, 2016 at 10:04 PM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
>> time_to_tm() takes time_t as an argument.
>> time_t is not y2038 safe.
>> Add time64_to_tm() that takes time64_t as an argument
>> which is y2038 safe.
>> The plan is to eventually replace all calls to time_to_tm()
>> by time64_to_tm().
>>
>> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
>> Cc: John Stultz <john.stultz@linaro.org>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>
> This looks sane to me. Are you hoping for me to queue this, or would
> you like i to go though the fsdev maintainers with my ack?
>
> In either case.
>
> Acked-by: John Stultz <john.stultz@linaro.org>

This is only used by the scsi fnic driver.
I will separate these 2 patches from this CURRENT_TIME series and
then both the patches can be merged through the respective trees.

-Deepa

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 17/21] audit: Use timespec64 to represent audit timestamps
  2016-06-09 23:59     ` Richard Guy Briggs
  2016-06-10  0:19       ` Steve Grubb
@ 2016-06-15 21:23       ` Paul Moore
  1 sibling, 0 replies; 54+ messages in thread
From: Paul Moore @ 2016-06-15 21:23 UTC (permalink / raw)
  To: Deepa Dinamani, Richard Guy Briggs, Steve Grubb
  Cc: Arnd Bergmann, y2038, linux-kernel, linux-audit, Al Viro,
	linux-fsdevel, Thomas Gleixner, Linus Torvalds

On Thu, Jun 9, 2016 at 7:59 PM, Richard Guy Briggs <rgb@redhat.com> wrote:
> On 16/06/09, Steve Grubb wrote:
>> On Wednesday, June 08, 2016 10:05:01 PM Deepa Dinamani wrote:
>> > struct timespec is not y2038 safe.
>> > Audit timestamps are recorded in string format into
>> > an audit buffer for a given context.
>> > These mark the entry timestamps for the syscalls.
>> > Use y2038 safe struct timespec64 to represent the times.
>> > The log strings can handle this transition as strings can
>> > hold upto 1024 characters.
>>
>> Have you tested this with ausearch or any audit utilities? As an aside, a time
>> stamp that is up to 1024 characters long is terribly wasteful considering how
>> many events we get.
>
> Steve,
>
> I don't expect the size of the time stamp text to change since the
> format isn't being changed and I don't expect the date stamp text length
> to change until Y10K, but you never know what will happen in 8
> millenia...  (Who knows, maybe that damn Linux server in my basement
> will still be running then...)

Yeah, I'm not really worried about the string date field growing; this
is more an internal implementation detail to make sure we can keep the
lights on in a few decades from now.

Deepa, I'm not going to merge your patchset because I'm guessing all
your timespec64 patches will likely go in at once, but you are free to
add my ack if you need to respin.

Acked-by: Paul Moore <paul@paul-moore.com>

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 15/21] time: Add time64_to_tm()
  2016-06-15 17:44     ` Deepa Dinamani
@ 2016-06-17 20:52       ` John Stultz
  2016-06-17 20:59         ` Deepa Dinamani
  0 siblings, 1 reply; 54+ messages in thread
From: John Stultz @ 2016-06-17 20:52 UTC (permalink / raw)
  To: Deepa Dinamani
  Cc: linux-fsdevel, lkml, Arnd Bergmann, Thomas Gleixner, Al Viro,
	Linus Torvalds, y2038 Mailman List

On Wed, Jun 15, 2016 at 10:44 AM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> On Tue, Jun 14, 2016 at 2:18 PM, John Stultz <john.stultz@linaro.org> wrote:
>> On Wed, Jun 8, 2016 at 10:04 PM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
>>> time_to_tm() takes time_t as an argument.
>>> time_t is not y2038 safe.
>>> Add time64_to_tm() that takes time64_t as an argument
>>> which is y2038 safe.
>>> The plan is to eventually replace all calls to time_to_tm()
>>> by time64_to_tm().
>>>
>>> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
>>> Cc: John Stultz <john.stultz@linaro.org>
>>> Cc: Thomas Gleixner <tglx@linutronix.de>
>>
>> This looks sane to me. Are you hoping for me to queue this, or would
>> you like i to go though the fsdev maintainers with my ack?
>>
>> In either case.
>>
>> Acked-by: John Stultz <john.stultz@linaro.org>
>
> This is only used by the scsi fnic driver.
> I will separate these 2 patches from this CURRENT_TIME series and
> then both the patches can be merged through the respective trees.

Sorry, this was not quite clear. I've gone ahead and queued this one
patch for testing, but let me know and I'll drop it if its going
through a different tree.

thanks
-john

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 15/21] time: Add time64_to_tm()
  2016-06-17 20:52       ` John Stultz
@ 2016-06-17 20:59         ` Deepa Dinamani
  2016-06-17 21:06           ` Arnd Bergmann
  0 siblings, 1 reply; 54+ messages in thread
From: Deepa Dinamani @ 2016-06-17 20:59 UTC (permalink / raw)
  To: John Stultz
  Cc: linux-fsdevel, lkml, Arnd Bergmann, Thomas Gleixner, Al Viro,
	Linus Torvalds, y2038 Mailman List

On Fri, Jun 17, 2016 at 1:52 PM, John Stultz <john.stultz@linaro.org> wrote:
> On Wed, Jun 15, 2016 at 10:44 AM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
>> On Tue, Jun 14, 2016 at 2:18 PM, John Stultz <john.stultz@linaro.org> wrote:
>>> On Wed, Jun 8, 2016 at 10:04 PM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
>>>> time_to_tm() takes time_t as an argument.
>>>> time_t is not y2038 safe.
>>>> Add time64_to_tm() that takes time64_t as an argument
>>>> which is y2038 safe.
>>>> The plan is to eventually replace all calls to time_to_tm()
>>>> by time64_to_tm().
>>>>
>>>> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
>>>> Cc: John Stultz <john.stultz@linaro.org>
>>>> Cc: Thomas Gleixner <tglx@linutronix.de>
>>>
>>> This looks sane to me. Are you hoping for me to queue this, or would
>>> you like i to go though the fsdev maintainers with my ack?
>>>
>>> In either case.
>>>
>>> Acked-by: John Stultz <john.stultz@linaro.org>
>>
>> This is only used by the scsi fnic driver.
>> I will separate these 2 patches from this CURRENT_TIME series and
>> then both the patches can be merged through the respective trees.
>
> Sorry, this was not quite clear. I've gone ahead and queued this one
> patch for testing, but let me know and I'll drop it if its going
> through a different tree.

Ok.This works too.

Thanks,
Deepa

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 15/21] time: Add time64_to_tm()
  2016-06-17 20:59         ` Deepa Dinamani
@ 2016-06-17 21:06           ` Arnd Bergmann
  0 siblings, 0 replies; 54+ messages in thread
From: Arnd Bergmann @ 2016-06-17 21:06 UTC (permalink / raw)
  To: Deepa Dinamani
  Cc: John Stultz, linux-fsdevel, lkml, Thomas Gleixner, Al Viro,
	Linus Torvalds, y2038 Mailman List

On Friday, June 17, 2016 1:59:06 PM CEST Deepa Dinamani wrote:
> On Fri, Jun 17, 2016 at 1:52 PM, John Stultz <john.stultz@linaro.org> wrote:
> > On Wed, Jun 15, 2016 at 10:44 AM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> >> On Tue, Jun 14, 2016 at 2:18 PM, John Stultz <john.stultz@linaro.org> wrote:
> >>> On Wed, Jun 8, 2016 at 10:04 PM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> >>>> time_to_tm() takes time_t as an argument.
> >>>> time_t is not y2038 safe.
> >>>> Add time64_to_tm() that takes time64_t as an argument
> >>>> which is y2038 safe.
> >>>> The plan is to eventually replace all calls to time_to_tm()
> >>>> by time64_to_tm().
> >>>>
> >>>> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
> >>>> Cc: John Stultz <john.stultz@linaro.org>
> >>>> Cc: Thomas Gleixner <tglx@linutronix.de>
> >>>
> >>> This looks sane to me. Are you hoping for me to queue this, or would
> >>> you like i to go though the fsdev maintainers with my ack?
> >>>
> >>> In either case.
> >>>
> >>> Acked-by: John Stultz <john.stultz@linaro.org>
> >>
> >> This is only used by the scsi fnic driver.
> >> I will separate these 2 patches from this CURRENT_TIME series and
> >> then both the patches can be merged through the respective trees.
> >
> > Sorry, this was not quite clear. I've gone ahead and queued this one
> > patch for testing, but let me know and I'll drop it if its going
> > through a different tree.
> 
> Ok.This works too.

Actually I have three more patches for other drivers that could use the
time64_to_tm() function. I'll post them next week and we can decide whether
we want to queue the driver changes on top (with the respective Ack).

	Arnd

^ permalink raw reply	[flat|nested] 54+ messages in thread

end of thread, other threads:[~2016-06-17 21:04 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-09  5:04 [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Deepa Dinamani
2016-06-09  5:04 ` [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time() Deepa Dinamani
2016-06-09  7:35   ` Jan Kara
2016-06-09 19:15     ` Linus Torvalds
2016-06-09 20:41       ` Deepa Dinamani
2016-06-09 12:31   ` Bob Copeland
2016-06-10 22:21   ` Arnd Bergmann
2016-06-11  5:03     ` Deepa Dinamani
2016-06-11 20:55       ` Arnd Bergmann
2016-06-09  5:04 ` [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps Deepa Dinamani
2016-06-09 18:45   ` Linus Torvalds
2016-06-09 18:55     ` Linus Torvalds
2016-06-10 22:19     ` [Y2038] " Arnd Bergmann
2016-06-14 17:55       ` Deepa Dinamani
2016-06-14 20:59         ` Arnd Bergmann
2016-06-09  5:04 ` [PATCH 03/21] fs: ubifs: " Deepa Dinamani
2016-06-09  5:04 ` [PATCH 05/21] fs: jfs: Replace CURRENT_TIME_SEC by current_fs_time() Deepa Dinamani
2016-06-09  5:04 ` [PATCH 06/21] fs: udf: Replace CURRENT_TIME with current_fs_time() Deepa Dinamani
2016-06-09  7:41   ` Jan Kara
2016-06-10  0:53     ` Deepa Dinamani
2016-06-09  5:04 ` [PATCH 07/21] fs: cifs: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani
2016-06-09  5:04 ` [PATCH 08/21] fs: cifs: Replace CURRENT_TIME with ktime_get_real_ts() Deepa Dinamani
2016-06-09  5:04 ` [PATCH 09/21] fs: cifs: Replace CURRENT_TIME by get_seconds Deepa Dinamani
2016-06-09  5:04 ` [PATCH 10/21] fs: f2fs: Use ktime_get_real_seconds for sit_info times Deepa Dinamani
2016-06-09  5:04 ` [PATCH 11/21] drivers: staging: lustre: Replace CURRENT_TIME with current_fs_time() Deepa Dinamani
2016-06-11  0:36   ` [lustre-devel] " James Simmons
2016-06-11  1:53     ` Andreas Dilger
2016-06-09  5:04 ` [PATCH 12/21] block: rbd: Replace non inode " Deepa Dinamani
2016-06-09  5:04 ` [PATCH 13/21] fs: ocfs2: Use time64_t to represent orphan scan times Deepa Dinamani
2016-06-09  5:04 ` [PATCH 14/21] fs: ocfs2: Replace CURRENT_TIME with ktime_get_real_seconds() Deepa Dinamani
2016-06-09  5:04 ` [PATCH 15/21] time: Add time64_to_tm() Deepa Dinamani
2016-06-14 21:18   ` John Stultz
2016-06-15 17:44     ` Deepa Dinamani
2016-06-17 20:52       ` John Stultz
2016-06-17 20:59         ` Deepa Dinamani
2016-06-17 21:06           ` Arnd Bergmann
2016-06-09  5:05 ` [PATCH 16/21] fnic: Use time64_t to represent trace timestamps Deepa Dinamani
2016-06-09  5:05 ` [PATCH 17/21] audit: Use timespec64 to represent audit timestamps Deepa Dinamani
2016-06-09 14:31   ` Steve Grubb
2016-06-09 23:59     ` Richard Guy Briggs
2016-06-10  0:19       ` Steve Grubb
2016-06-10  1:44         ` Richard Guy Briggs
2016-06-15 21:23       ` Paul Moore
2016-06-10  0:45     ` Deepa Dinamani
2016-06-09  5:05 ` [PATCH 18/21] fs: nfs: Make nfs boot time y2038 safe Deepa Dinamani
2016-06-09 19:23   ` Trond Myklebust
2016-06-09 21:10     ` Deepa Dinamani
2016-06-10 13:12       ` Anna Schumaker
2016-06-10 14:02         ` Trond Myklebust
2016-06-09  5:05 ` [PATCH 19/21] libceph: Remove CURRENT_TIME references Deepa Dinamani
2016-06-09  5:05 ` [PATCH 20/21] libceph: Replace CURRENT_TIME with ktime_get_real_ts Deepa Dinamani
2016-06-09  5:05 ` [PATCH 21/21] time: Delete CURRENT_TIME_SEC and CURRENT_TIME macro Deepa Dinamani
2016-06-14 21:20   ` John Stultz
2016-06-09  7:51 ` [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros Felipe Balbi

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).