Skip to contentSkip to conversation

Question regarding struct ceph_timestamp

DISCUSSION Luis Henriques 2 participants 3 messages May 9, 2017

lore
Share & tools
lore
#0 lore raw

Hi,

While analysing an xfstest failure (generic/258) I had to look at the definition of struct ceph_timespec. And I was surprised to verify that both its fields (tv_sec and tv_nsec) are 32-bits (__le32). And I believe that this explains the test failure, as ceph_encode_timespec() would fail to convert the negative pre-epoch value (-315615540 => 3979351756).

The failure can be easily reproduced by simply creating a test file in a cephfs mount with:

 $ touch -t 196001010101 /mnt/testfile
 $ ls -l /mnt/testfile
 -rw-r--r-- 1 root 0 0 Jan  1  1960 testfile

After remounting the filesystem:

 $ ls -l /mnt/testfile
 -rw-r--r-- 1 root 0 0 Feb  6  2096 testfile

Am I missing something? If I'm not (and I probably am!), this isn't just a client-side issue and fixing it will require touching several other parts of the code.

Cheers,
--
Luís

#1 lore raw
Quoted 15 lines · Luis Henriques

Hi,

While analysing an xfstest failure (generic/258) I had to look at the definition of struct ceph_timespec. And I was surprised to verify that both its fields (tv_sec and tv_nsec) are 32-bits (__le32). And I believe that this explains the test failure, as ceph_encode_timespec() would fail to convert the negative pre-epoch value (-315615540 => 3979351756).

The failure can be easily reproduced by simply creating a test file in a cephfs mount with:

 $ touch -t 196001010101 /mnt/testfile
 $ ls -l /mnt/testfile
 -rw-r--r-- 1 root 0 0 Jan  1  1960 testfile
Quoted 8 lines

After remounting the filesystem:

 $ ls -l /mnt/testfile
 -rw-r--r-- 1 root 0 0 Feb  6  2096 testfile

Am I missing something? If I'm not (and I probably am!), this isn't just a client-side issue and fixing it will require touching several other parts of the code.

I haven't done any work with most of the kernel code, but I believe this was discussed last year:
https://patchwork.kernel.org/patch/8308691/
-Greg

#2 lore raw
Quoted 21 lines · Gregory Farnum
Quoted 20 lines · Luis Henriques

Hi,

While analysing an xfstest failure (generic/258) I had to look at the definition of struct ceph_timespec. And I was surprised to verify that both its fields (tv_sec and tv_nsec) are 32-bits (__le32). And I believe that this explains the test failure, as ceph_encode_timespec() would fail to convert the negative pre-epoch value (-315615540 => 3979351756).

The failure can be easily reproduced by simply creating a test file in a cephfs mount with:

 $ touch -t 196001010101 /mnt/testfile
 $ ls -l /mnt/testfile
 -rw-r--r-- 1 root 0 0 Jan  1  1960 testfile

After remounting the filesystem:

 $ ls -l /mnt/testfile
 -rw-r--r-- 1 root 0 0 Feb  6  2096 testfile
Quoted 7 lines
Quoted 3 lines

Am I missing something? If I'm not (and I probably am!), this isn't just a client-side issue and fixing it will require touching several other parts of the code.

I haven't done any work with most of the kernel code, but I believe this was discussed last year:
https://patchwork.kernel.org/patch/8308691/

Ah, awesome! Thanks for pointing me to this thread. I did a quick search before sending my email but failed to find it. Anyway, that discussion contains lots of interesting information around the issue and it looks like it is being taken care of. Again, thanks Greg!

Cheers,
--
Luís