cifs: use 64-bit timestamps for fscache
authorArnd Bergmann <arnd@arndb.de>
Tue, 19 Jun 2018 15:27:59 +0000 (17:27 +0200)
committerSteve French <stfrench@microsoft.com>
Tue, 7 Aug 2018 19:15:41 +0000 (14:15 -0500)
In the fscache, we just need the timestamps as cookies to check for
changes, so we don't really care about the overflow, but it's better
to stop using the deprecated timespec so we don't have to go through
explicit conversion functions.

To avoid comparing uninitialized padding values that are copied
while assigning the timespec values, this rearranges the members of
cifs_fscache_inode_auxdata to avoid padding, and assigns them
individually.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Paulo Alcantara <palcantara@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/cache.c
fs/cifs/fscache.c
fs/cifs/fscache.h

index e1553d1e0e504335f186e55d11410478cf56459c..b7420e605b28804be516a5cd9c2ab250bffc5ea0 100644 (file)
@@ -128,8 +128,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 = timespec64_to_timespec(cifsi->vfs_inode.i_mtime);
-       auxdata.last_change_time = timespec64_to_timespec(cifsi->vfs_inode.i_ctime);
+       auxdata.last_write_time_sec = cifsi->vfs_inode.i_mtime.tv_sec;
+       auxdata.last_change_time_sec = cifsi->vfs_inode.i_ctime.tv_sec;
+       auxdata.last_write_time_nsec = cifsi->vfs_inode.i_mtime.tv_nsec;
+       auxdata.last_change_time_nsec = cifsi->vfs_inode.i_ctime.tv_nsec;
 
        if (memcmp(data, &auxdata, datalen) != 0)
                return FSCACHE_CHECKAUX_OBSOLETE;
index 85145a7630216b0941d71d8cc5b9bb8d6f409af1..ea6ace9c2417dd954047799e691a7759cd2c5471 100644 (file)
@@ -129,8 +129,10 @@ static void cifs_fscache_acquire_inode_cookie(struct cifsInodeInfo *cifsi,
 
        memset(&auxdata, 0, sizeof(auxdata));
        auxdata.eof = cifsi->server_eof;
-       auxdata.last_write_time = timespec64_to_timespec(cifsi->vfs_inode.i_mtime);
-       auxdata.last_change_time = timespec64_to_timespec(cifsi->vfs_inode.i_ctime);
+       auxdata.last_write_time_sec = cifsi->vfs_inode.i_mtime.tv_sec;
+       auxdata.last_change_time_sec = cifsi->vfs_inode.i_ctime.tv_sec;
+       auxdata.last_write_time_nsec = cifsi->vfs_inode.i_mtime.tv_nsec;
+       auxdata.last_change_time_nsec = cifsi->vfs_inode.i_ctime.tv_nsec;
 
        cifsi->fscache =
                fscache_acquire_cookie(tcon->fscache,
@@ -166,8 +168,10 @@ void cifs_fscache_release_inode_cookie(struct inode *inode)
        if (cifsi->fscache) {
                memset(&auxdata, 0, sizeof(auxdata));
                auxdata.eof = cifsi->server_eof;
-               auxdata.last_write_time = timespec64_to_timespec(cifsi->vfs_inode.i_mtime);
-               auxdata.last_change_time = timespec64_to_timespec(cifsi->vfs_inode.i_ctime);
+               auxdata.last_write_time_sec = cifsi->vfs_inode.i_mtime.tv_sec;
+               auxdata.last_change_time_sec = cifsi->vfs_inode.i_ctime.tv_sec;
+               auxdata.last_write_time_nsec = cifsi->vfs_inode.i_mtime.tv_nsec;
+               auxdata.last_change_time_nsec = cifsi->vfs_inode.i_ctime.tv_nsec;
 
                cifs_dbg(FYI, "%s: (0x%p)\n", __func__, cifsi->fscache);
                fscache_relinquish_cookie(cifsi->fscache, &auxdata, false);
index c7e3ac251e1616c5ec9b5a0ae0103088c483f9fa..8c0862e413064c32a6df043e8d27f0d8530b2849 100644 (file)
  * Auxiliary data attached to CIFS inode within the cache
  */
 struct cifs_fscache_inode_auxdata {
-       struct timespec last_write_time;
-       struct timespec last_change_time;
-       u64             eof;
+       u64 last_write_time_sec;
+       u64 last_change_time_sec;
+       u32 last_write_time_nsec;
+       u32 last_change_time_nsec;
+       u64 eof;
 };
 
 /*