Project

General

Profile

Bug #7122

fix negative timestamps with nsec == 0 in nfs4_time_ntov()

Added by Jan Schlien over 4 years ago. Updated over 4 years ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
nfs - NFS server and client
Start date:
2016-06-21
Due date:
% Done:

0%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

nfs4_time_ntov converts timestamps from nfs4-style to vattr_t representation. Negative timestamps are represented differently and thus the conversion code:

       if (ntime->seconds < 0) {
               sec = ntime->seconds + 1;
               nsec = -1000000000 + ntime->nseconds;
       } else {
               sec = ntime->seconds;
               nsec = ntime->nseconds;
       }

This code is obviously wrong for ntime->nseconds == 0:

$ touch -m -d 1969-12-25T01:00:00 /mnt/nfs/file
$ stat /mnt/nfs/file
Modify: 1969-12-25 01:00:01.-1000000000 200

Network transfer looks correct, though:

NFS:  Op = 34 (SETATTR)   
NFS:  State ID hash = SPECIAL_0
NFS:      len = 12    val = 000000000000000000000000
NFS:      State ID Sequence ID = 00000000
NFS:    0x00
NFS:    0x00
NFS:    0x00
NFS:    0x00
NFS:    0x00
NFS:    0x00
NFS:    0x40   TIME_MODIFY_SET
NFS:    0x00
NFS:  Modification Time = -604800.000000 (set to client time)
...
NFS:  Op = 9 (GETATTR)
NFS:  Status = 0 (NFS4_OK)
NFS:    0x1a   SIZE CHANGE TYPE
NFS:    0x01   FSID
NFS:    0x10   FILEID
NFS:    0x00  
NFS:    0x3a   OWNER_GROUP OWNER NUMLINKS MODE
NFS:    0xa2   TIME_ACCESS SPACE_USED RAWDEV
NFS:    0xb0   MOUNTED_ON_FILEID TIME_MODIFY TIME_METADATA
NFS:    0x00  
NFS:  Type = REG
NFS:  Change ID = 0x5769275812aa446c
NFS:  Size = 0
NFS:  FS ID: Major = 546bdc0842154d96, Minor = 0
NFS:  File ID = 8
NFS:  Mode = 0644
NFS:  Number of Links = 1
NFS:  Owner = root@iata
NFS:  Group = root@iata
NFS:  Raw Device ID = 4294967295, 4294967295
NFS:  Space Used (this object) = 512
NFS:  Last Access Time = 21-Jun-16 11:19:40.248057748 GMT
NFS:  Last Metadata Change Time = 21-Jun-16 11:39:04.313148524 GMT
NFS:  Last Modification Time = -604800.000000
NFS:  Mounted On File ID = 8
#1

Updated by Marcel Telka over 4 years ago

  • Category set to nfs - NFS server and client

Also available in: Atom PDF