lkml.org 
[lkml]   [2016]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC v2c 2/8] fs: cifs: Change auxdata to struct timespec64 data type
Date
Aux data timestamps are only used to read in inode timestamps for
fscache.

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 accessor functions to access inode times before the vfs
change.

Also convert the timestamp data types in the individual filesystems to
use y2038 safe struct timespec64.

The data type change from struct timespec to struct timespec64 is safe
because
1.Size of auxdata on 64 bit systems already accounts for struct timespec64.
2.Only auxdata length changes(increases) by a maximum of 128 bits
(data type increase and alignment adjustments).
3.Everything else is the same size as before and possibly less big than on
64 bit systems.
4.64 bit data is aligned on a 64 bit boundary even on 32 bit systems,
making the alignment requirements also same as on 64 bit systems,
except for i386 where alignment requirements pack the struct tighter.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
---
fs/cifs/cache.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/fs/cifs/cache.c b/fs/cifs/cache.c
index 6c665bf..713055b 100644
--- a/fs/cifs/cache.c
+++ b/fs/cifs/cache.c
@@ -221,8 +221,8 @@ const struct fscache_cookie_def cifs_fscache_super_index_def = {
* Auxiliary data attached to CIFS inode within the cache
*/
struct cifs_fscache_inode_auxdata {
- struct timespec last_write_time;
- struct timespec last_change_time;
+ struct timespec64 last_write_time;
+ struct timespec64 last_change_time;
u64 eof;
};

@@ -259,8 +259,10 @@ cifs_fscache_inode_get_aux(const void *cookie_netfs_data, void *buffer,

memset(&auxdata, 0, sizeof(auxdata));
auxdata.eof = cifsi->server_eof;
- auxdata.last_write_time = cifsi->vfs_inode.i_mtime;
- auxdata.last_change_time = cifsi->vfs_inode.i_ctime;
+ auxdata.last_write_time =
+ vfs_time_to_timespec64(cifsi->vfs_inode.i_mtime);
+ auxdata.last_change_time =
+ vfs_time_to_timespec64(cifsi->vfs_inode.i_ctime);

if (maxbuf > sizeof(auxdata))
maxbuf = sizeof(auxdata);
@@ -283,8 +285,10 @@ fscache_checkaux cifs_fscache_inode_check_aux(void *cookie_netfs_data,

memset(&auxdata, 0, sizeof(auxdata));
auxdata.eof = cifsi->server_eof;
- auxdata.last_write_time = cifsi->vfs_inode.i_mtime;
- auxdata.last_change_time = cifsi->vfs_inode.i_ctime;
+ auxdata.last_write_time =
+ vfs_time_to_timespec64(cifsi->vfs_inode.i_mtime);
+ auxdata.last_change_time =
+ vfs_time_to_timespec64(cifsi->vfs_inode.i_ctime);

if (memcmp(data, &auxdata, datalen) != 0)
return FSCACHE_CHECKAUX_OBSOLETE;
--
1.9.1
\
 
 \ /
  Last update: 2016-02-12 11:01    [W:0.189 / U:5.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site