[Y2038] [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()

2016-06-21 Thread Deepa Dinamani
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 
Cc: Artem Bityutskiy 
Cc: Adrian Hunter 
Cc: linux-...@lists.infradead.org
Cc: Evgeniy Dushistov 
Cc: OGAWA Hirofumi 
Cc: Jan Kara 
Cc: linux-e...@vger.kernel.org
Cc: David Howells 
Cc: linux-...@lists.infradead.org
Cc: "Tigran A. Aivazian" 
Cc: linux-fsde...@vger.kernel.org
Cc: "Theodore Ts'o" 
Cc: Andreas Dilger 
Cc: Jan Kara 
Cc: Jan Harkes 
Cc: c...@cs.cmu.edu
Cc: codal...@coda.cs.cmu.edu
Cc: Bob Copeland 
Cc: linux-karma-de...@lists.sourceforge.net
Cc: Christoph Hellwig 
---
 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(_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 

Re: [Y2038] [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()

2016-06-11 Thread Arnd Bergmann
On Friday, June 10, 2016 10:03:14 PM CEST Deepa Dinamani wrote:
> On Fri, Jun 10, 2016 at 3:21 PM, Arnd Bergmann  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

___
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038


Re: [Y2038] [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()

2016-06-10 Thread Deepa Dinamani
On Fri, Jun 10, 2016 at 3:21 PM, Arnd Bergmann  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 
>
> 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
___
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038


Re: [Y2038] [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()

2016-06-10 Thread Arnd Bergmann
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 

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
___
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038


Re: [Y2038] [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()

2016-06-09 Thread Linus Torvalds
On Thu, Jun 9, 2016 at 12:35 AM, Jan Kara  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
___
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038


Re: [Y2038] [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()

2016-06-09 Thread Bob Copeland
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 

OMFS parts look sane, thanks.

-- 
Bob Copeland %% http://bobcopeland.com/
___
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038


Re: [Y2038] [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()

2016-06-09 Thread Jan Kara
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 

Honza
-- 
Jan Kara 
SUSE Labs, CR
___
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038