vfs/y2038: inode timestamps conversion to timespec64

This is a late set of changes from Deepa Dinamani doing an automated
treewide conversion of the inode and iattr structures from 'timespec'
to 'timespec64', to push the conversion from the VFS layer into the
individual file systems.

There were no conflicts between this and the contents of linux-next
until just before the merge window, when we saw multiple problems:

- A minor conflict with my own y2038 fixes, which I could address
  by adding another patch on top here.
- One semantic conflict with late changes to the NFS tree. I addressed
  this by merging Deepa's original branch on top of the changes that
  now got merged into mainline and making sure the merge commit includes
  the necessary changes as produced by coccinelle.
- A trivial conflict against the removal of staging/lustre.
- Multiple conflicts against the VFS changes in the overlayfs tree.
  These are still part of linux-next, but apparently this is no longer
  intended for 4.18 [1], so I am ignoring that part.

As Deepa writes:

  The series aims to switch vfs timestamps to use struct timespec64.
  Currently vfs uses struct timespec, which is not y2038 safe.

  The series involves the following:
  1. Add vfs helper functions for supporting struct timepec64 timestamps.
  2. Cast prints of vfs timestamps to avoid warnings after the switch.
  3. Simplify code using vfs timestamps so that the actual
     replacement becomes easy.
  4. Convert vfs timestamps to use struct timespec64 using a script.
     This is a flag day patch.

  Next steps:
  1. Convert APIs that can handle timespec64, instead of converting
     timestamps at the boundaries.
  2. Update internal data structures to avoid timestamp conversions.

Thomas Gleixner adds:

  I think there is no point to drag that out for the next merge window.
  The whole thing needs to be done in one go for the core changes which
  means that you're going to play that catchup game forever. Let's get
  over with it towards the end of the merge window.

[1] https://www.spinics.net/lists/linux-fsdevel/msg128294.html
Version: GnuPG v1

pstore: Remove bogus format string definition

The pstore conversion to timespec64 introduces its own method of passing
seconds into sscanf() and sprintf() type functions to work around the
timespec64 definition on 64-bit systems that redefine it to 'timespec'.

That hack is now finally getting removed, but that means we get a (harmless)
warning once both patches are merged:

fs/pstore/ram.c: In function 'ramoops_read_kmsg_hdr':
fs/pstore/ram.c:39:29: error: format '%ld' expects argument of type 'long int *', but argument 3 has type 'time64_t *' {aka 'long long int *'} [-Werror=format=]
 #define RAMOOPS_KERNMSG_HDR "===="
fs/pstore/ram.c:167:21: note: in expansion of macro 'RAMOOPS_KERNMSG_HDR'

This removes the pstore specific workaround and uses the same method that
we have in place for all other functions that print a timespec64.

Related to this, I found that the kasprintf() output contains an incorrect
nanosecond values for any number starting with zeroes, and I adapt the
format string accordingly.

Link: https://lkml.org/lkml/2018/5/19/115
Link: https://lkml.org/lkml/2018/5/16/1080
Fixes: 0f0d83b99ef7 ("pstore: Convert internal records to timespec64")
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 file changed