lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1455270773-3249-6-git-send-email-deepa.kernel@gmail.com>
Date:	Fri, 12 Feb 2016 01:52:50 -0800
From:	Deepa Dinamani <deepa.kernel@...il.com>
To:	linux-fsdevel@...r.kernel.org, y2038@...ts.linaro.org
Cc:	Arnd Bergmann <arnd@...db.de>, Dave Chinner <david@...morbit.com>,
	"Theodore Ts'o" <tytso@....edu>, linux-kernel@...r.kernel.org
Subject: [RFC v2c 5/8] fs: btrfs: Change btrfs_inode.i_otime to vfs_time data type

The VFS inode timestamps are not y2038 safe as they use
struct timespec. These will be changed to use struct timespec64
instead and that is y2038 safe.
But, since the above data type conversion will break the end
file systems, use timespec64 and conversion functions here to
access inode times.

struct btrfs_inode is the in memory inode structure for btrfs.
i_otime is a member of the btrfs_inode that represents file
creation times. Use struct timespec64 to represent this
timestamp.

Like all the other inode timestamps in struct inode, i_otime is
assigned to/ from disk or struct inode times or 0.

Hence, i_otime needs to use accessor functions to access inode
timestamps.

Signed-off-by: Deepa Dinamani <deepa.kernel@...il.com>
---
 fs/btrfs/btrfs_inode.h | 2 +-
 fs/btrfs/inode.c       | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index 61205e3..5200e68 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -190,7 +190,7 @@ struct btrfs_inode {
 	struct btrfs_delayed_node *delayed_node;
 
 	/* File creation time. */
-	struct timespec i_otime;
+	struct timespec64 i_otime;
 
 	/* Hook into fs_info->delayed_iputs */
 	struct list_head delayed_iput;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 59c0e22..bcd223c 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5592,7 +5592,7 @@ static struct inode *new_simple_dir(struct super_block *s,
 	inode->i_mtime = current_fs_time(inode->i_sb);
 	inode->i_atime = inode->i_mtime;
 	inode->i_ctime = inode->i_mtime;
-	BTRFS_I(inode)->i_otime = inode->i_mtime;
+	BTRFS_I(inode)->i_otime = vfs_time_to_timespec64(inode->i_mtime);
 
 	return inode;
 }
@@ -6164,7 +6164,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
 	inode->i_mtime = current_fs_time(inode->i_sb);
 	inode->i_atime = inode->i_mtime;
 	inode->i_ctime = inode->i_mtime;
-	BTRFS_I(inode)->i_otime = inode->i_mtime;
+	BTRFS_I(inode)->i_otime = vfs_time_to_timespec64(inode->i_mtime);
 
 	inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0],
 				  struct btrfs_inode_item);
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ