Re: [Y2038] [RESEND PATCH] fs: jfs: Replace CURRENT_TIME_SEC by current_time()

2016-11-11 Thread Deepa Dinamani
On Fri, Nov 11, 2016 at 10:42 AM, Dave Kleikamp
 wrote:
> On 11/11/2016 12:00 PM, Deepa Dinamani wrote:
>> jfs uses nanosecond granularity for filesystem timestamps.
>> Only this assignment is not using nanosecond granularity.
>> Use current_time() to get the right granularity.
>
> I had thought these were being handled as a group. I'll push this one
> through the jfs tree.

Yes, that was the original plan.
Then, Greg suggested pushing only the big patches as a group and
sending individual filesystem patches separately.
Big patches introducing current_time() have been merged in 4.9 rc1.

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


Re: [Y2038] [RESEND PATCH] fs: jfs: Replace CURRENT_TIME_SEC by current_time()

2016-11-11 Thread Dave Kleikamp
On 11/11/2016 12:00 PM, Deepa Dinamani wrote:
> jfs uses nanosecond granularity for filesystem timestamps.
> Only this assignment is not using nanosecond granularity.
> Use current_time() to get the right granularity.

I had thought these were being handled as a group. I'll push this one
through the jfs tree.

Thanks,
Shaggy

> 
> Signed-off-by: Deepa Dinamani 
> Acked-by: Dave Kleikamp 
> Reviewed-by: Arnd Bergmann 
> ---
>  fs/jfs/ioctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c
> index 8653cac..b6fd1ff 100644
> --- a/fs/jfs/ioctl.c
> +++ b/fs/jfs/ioctl.c
> @@ -121,7 +121,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_time(inode);
>   mark_inode_dirty(inode);
>  setflags_out:
>   mnt_drop_write_file(filp);
> 
___
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038


[Y2038] [RESEND PATCH] fs: ext4: Use current_time() for inode timestamps

2016-11-11 Thread Deepa Dinamani
CURRENT_TIME_SEC and CURRENT_TIME are not y2038 safe.
current_time() will be transitioned to be y2038 safe
along with vfs.

current_time() returns timestamps according to the
granularities set in the super_block.
The granularity check in ext4_current_time() to call
current_time() or CURRENT_TIME_SEC is not required.
Use current_time() directly to obtain timestamps
unconditionally, and remove ext4_current_time().

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

Signed-off-by: Deepa Dinamani 
Reviewed-by: Arnd Bergmann 
---
 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 dfa5199..fd38993 100644
--- a/fs/ext4/acl.c
+++ b/fs/ext4/acl.c
@@ -196,7 +196,7 @@ __ext4_set_acl(handle_t *handle, struct inode *inode, int 
type,
error = posix_acl_update_mode(inode, >i_mode, 
);
if (error)
return error;
-   inode->i_ctime = ext4_current_time(inode);
+   inode->i_ctime = current_time(inode);
ext4_mark_inode_dirty(handle, inode);
}
break;
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 282a51b..6789379 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1532,12 +1532,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 c930a01..786be87 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4725,7 +4725,7 @@ static int ext4_alloc_file_blocks(struct file *file, 
ext4_lblk_t offset,
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_time(inode);
if (new_size) {
if (epos > new_size)
epos = new_size;
@@ -4853,7 +4853,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_time(inode);
 
ret = ext4_alloc_file_blocks(file, lblk, max_blocks, new_size,
 flags, mode);
@@ -4878,7 +4878,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_time(inode);
if (new_size) {
ext4_update_inode_size(inode, new_size);
} else {
@@ -5568,7 +5568,7 @@ int ext4_collapse_range(struct inode *inode, loff_t 
offset, loff_t len)
up_write(_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_time(inode);
ext4_mark_inode_dirty(handle, inode);
 
 out_stop:
@@ -5678,7 +5678,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_time(inode);
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 170421e..088afe0 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -1039,7 +1039,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct 
inode *dir,
/* 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 =
- 

[Y2038] [RESEND PATCH] fs: jfs: Replace CURRENT_TIME_SEC by current_time()

2016-11-11 Thread Deepa Dinamani
jfs uses nanosecond granularity for filesystem timestamps.
Only this assignment is not using nanosecond granularity.
Use current_time() to get the right granularity.

Signed-off-by: Deepa Dinamani 
Acked-by: Dave Kleikamp 
Reviewed-by: Arnd Bergmann 
---
 fs/jfs/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c
index 8653cac..b6fd1ff 100644
--- a/fs/jfs/ioctl.c
+++ b/fs/jfs/ioctl.c
@@ -121,7 +121,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_time(inode);
mark_inode_dirty(inode);
 setflags_out:
mnt_drop_write_file(filp);
-- 
2.7.4

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


[Y2038] [RESEND PATCH] fs: ufs: Use ktime_get_real_ts64() for birthtime

2016-11-11 Thread Deepa Dinamani
CURRENT_TIME is not y2038 safe.
Replace it with ktime_get_real_ts64().
Inode time formats are already 64 bit long and
accommodates time64_t.

Signed-off-by: Deepa Dinamani 
---
 fs/ufs/ialloc.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index 9774555..d1dd8cc 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 timespec64 ts;
unsigned cg, bit, i, j, start;
struct ufs_inode_info *ufsi;
int err = -ENOSPC;
@@ -323,8 +324,9 @@ struct inode *ufs_new_inode(struct inode *dir, umode_t mode)
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);
+   ktime_get_real_ts64();
+   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)
-- 
2.7.4

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