* [PATCH 03/10] fs: cifs: Replace CURRENT_TIME with current_fs_time()
[not found] <1454479670-8204-1-git-send-email-deepa.kernel@gmail.com>
@ 2016-02-03 6:07 ` Deepa Dinamani
2016-02-03 6:07 ` [PATCH 04/10] fs: cifs: Replace CURRENT_TIME with ktime_get_real_ts() Deepa Dinamani
2016-02-03 6:07 ` [PATCH 05/10] fs: cifs: Replace CURRENT_TIME by get_seconds Deepa Dinamani
2 siblings, 0 replies; 3+ messages in thread
From: Deepa Dinamani @ 2016-02-03 6:07 UTC (permalink / raw)
To: linux-fsdevel, y2038
Cc: Arnd Bergmann, Dave Chinner, Theodore Ts'o, linux-kernel,
Steve French, linux-cifs, samba-technical
CURRENT_TIME macro is not appropriate for filesystems as it
doesn't use the right granularity for filesystem timestamps.
Use current_fs_time() instead.
Change signature of helper cifs_all_info_to_fattr since it
now needs both super_block and cifs_sb_info.
Note: The inode timestamps read from the server are assumed
to have correct granularity and range.
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Steve French <sfrench@samba.org>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
---
fs/cifs/inode.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index aeb26db..fa72359 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -320,9 +320,8 @@ cifs_create_dfs_fattr(struct cifs_fattr *fattr, struct super_block *sb)
fattr->cf_mode = S_IFDIR | S_IXUGO | S_IRWXU;
fattr->cf_uid = cifs_sb->mnt_uid;
fattr->cf_gid = cifs_sb->mnt_gid;
- fattr->cf_atime = CURRENT_TIME;
- fattr->cf_ctime = CURRENT_TIME;
- fattr->cf_mtime = CURRENT_TIME;
+ fattr->cf_atime = fattr->cf_ctime =
+ fattr->cf_mtime = current_fs_time(sb);
fattr->cf_nlink = 2;
fattr->cf_flags |= CIFS_FATTR_DFS_REFERRAL;
}
@@ -584,9 +583,10 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path,
/* Fill a cifs_fattr struct with info from FILE_ALL_INFO */
static void
cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
- struct cifs_sb_info *cifs_sb, bool adjust_tz,
+ struct super_block *sb, bool adjust_tz,
bool symlink)
{
+ struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
memset(fattr, 0, sizeof(*fattr));
@@ -597,7 +597,7 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
if (info->LastAccessTime)
fattr->cf_atime = cifs_NTtimeToUnix(info->LastAccessTime);
else
- fattr->cf_atime = CURRENT_TIME;
+ fattr->cf_atime = current_fs_time(sb);
fattr->cf_ctime = cifs_NTtimeToUnix(info->ChangeTime);
fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime);
@@ -657,7 +657,6 @@ cifs_get_file_info(struct file *filp)
FILE_ALL_INFO find_data;
struct cifs_fattr fattr;
struct inode *inode = file_inode(filp);
- struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifsFileInfo *cfile = filp->private_data;
struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
struct TCP_Server_Info *server = tcon->ses->server;
@@ -669,7 +668,7 @@ cifs_get_file_info(struct file *filp)
rc = server->ops->query_file_info(xid, tcon, &cfile->fid, &find_data);
switch (rc) {
case 0:
- cifs_all_info_to_fattr(&fattr, &find_data, cifs_sb, false,
+ cifs_all_info_to_fattr(&fattr, &find_data, inode->i_sb, false,
false);
break;
case -EREMOTE:
@@ -751,7 +750,7 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
}
if (!rc) {
- cifs_all_info_to_fattr(&fattr, data, cifs_sb, adjust_tz,
+ cifs_all_info_to_fattr(&fattr, data, sb, adjust_tz,
symlink);
} else if (rc == -EREMOTE) {
cifs_create_dfs_fattr(&fattr, sb);
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 04/10] fs: cifs: Replace CURRENT_TIME with ktime_get_real_ts()
[not found] <1454479670-8204-1-git-send-email-deepa.kernel@gmail.com>
2016-02-03 6:07 ` [PATCH 03/10] fs: cifs: Replace CURRENT_TIME with current_fs_time() Deepa Dinamani
@ 2016-02-03 6:07 ` Deepa Dinamani
2016-02-03 6:07 ` [PATCH 05/10] fs: cifs: Replace CURRENT_TIME by get_seconds Deepa Dinamani
2 siblings, 0 replies; 3+ messages in thread
From: Deepa Dinamani @ 2016-02-03 6:07 UTC (permalink / raw)
To: linux-fsdevel, y2038
Cc: linux-cifs, Theodore Ts'o, Arnd Bergmann, samba-technical,
Dave Chinner, linux-kernel, Steve French
This is in preparation for the series that transitions
filesystem timestamps to use 64 bit time and hence make
them y2038 safe.
CURRENT_TIME macro will be deleted before merging the
aforementioned series.
Filesystem times will use current_fs_time() instead of
CURRENT_TIME.
Use ktime_get_real_ts() here as this is not filesystem time.
ktime_get_real_ts() returns the timestamp in ns which can
be used to calculate network time for NTLMv2 authentication
timestamp.
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Steve French <sfrench@samba.org>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
---
fs/cifs/cifsencrypt.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index d411654..f86e07d 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -460,6 +460,7 @@ find_timestamp(struct cifs_ses *ses)
unsigned char *blobptr;
unsigned char *blobend;
struct ntlmssp2_name *attrptr;
+ struct timespec ts;
if (!ses->auth_key.len || !ses->auth_key.response)
return 0;
@@ -484,7 +485,8 @@ find_timestamp(struct cifs_ses *ses)
blobptr += attrsize; /* advance attr value */
}
- return cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME));
+ ktime_get_real_ts(&ts);
+ return cpu_to_le64(cifs_UnixTimeToNT(ts));
}
static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
--
1.9.1
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 05/10] fs: cifs: Replace CURRENT_TIME by get_seconds
[not found] <1454479670-8204-1-git-send-email-deepa.kernel@gmail.com>
2016-02-03 6:07 ` [PATCH 03/10] fs: cifs: Replace CURRENT_TIME with current_fs_time() Deepa Dinamani
2016-02-03 6:07 ` [PATCH 04/10] fs: cifs: Replace CURRENT_TIME with ktime_get_real_ts() Deepa Dinamani
@ 2016-02-03 6:07 ` Deepa Dinamani
2 siblings, 0 replies; 3+ messages in thread
From: Deepa Dinamani @ 2016-02-03 6:07 UTC (permalink / raw)
To: linux-fsdevel, y2038
Cc: Arnd Bergmann, Dave Chinner, Theodore Ts'o, linux-kernel,
Steve French, linux-cifs, samba-technical
This is in preparation for the series that transitions
filesystem timestamps to use 64 bit time and hence make
them y2038 safe.
CURRENT_TIME macro will be deleted before merging the
aforementioned series.
Filesystems will use current_fs_time() instead of
CURRENT_TIME.
Use get_seconds() here as this is not filesystem time.
Only the seconds portion of the timestamp is necessary for
timezone calculation using server time.
Assume that the difference between server and client times
lie in the range INT_MIN..INT_MAX. This is valid because
this is the difference between current times between server
and client, and the largest timezone difference is in the
range of one day.
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Steve French <sfrench@samba.org>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
---
fs/cifs/cifssmb.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 90b4f9f..1a9e43d 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -478,14 +478,14 @@ decode_lanman_negprot_rsp(struct TCP_Server_Info *server, NEGOTIATE_RSP *pSMBr)
* this requirement.
*/
int val, seconds, remain, result;
- struct timespec ts, utc;
- utc = CURRENT_TIME;
+ struct timespec ts;
+ unsigned long utc = get_seconds();
ts = cnvrtDosUnixTm(rsp->SrvTime.Date,
rsp->SrvTime.Time, 0);
cifs_dbg(FYI, "SrvTime %d sec since 1970 (utc: %d) diff: %d\n",
- (int)ts.tv_sec, (int)utc.tv_sec,
- (int)(utc.tv_sec - ts.tv_sec));
- val = (int)(utc.tv_sec - ts.tv_sec);
+ (int)ts.tv_sec, (int)utc,
+ (int)(utc - ts.tv_sec));
+ val = (int)(utc - ts.tv_sec);
seconds = abs(val);
result = (seconds / MIN_TZ_ADJ) * MIN_TZ_ADJ;
remain = seconds % MIN_TZ_ADJ;
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-03 6:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1454479670-8204-1-git-send-email-deepa.kernel@gmail.com>
2016-02-03 6:07 ` [PATCH 03/10] fs: cifs: Replace CURRENT_TIME with current_fs_time() Deepa Dinamani
2016-02-03 6:07 ` [PATCH 04/10] fs: cifs: Replace CURRENT_TIME with ktime_get_real_ts() Deepa Dinamani
2016-02-03 6:07 ` [PATCH 05/10] fs: cifs: Replace CURRENT_TIME by get_seconds Deepa Dinamani
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).