diff -Nru openafs-1.8.0~pre5/debian/changelog openafs-1.8.0~pre5/debian/changelog --- openafs-1.8.0~pre5/debian/changelog 2018-11-21 13:26:34.000000000 +0000 +++ openafs-1.8.0~pre5/debian/changelog 2019-09-23 15:49:23.000000000 +0000 @@ -1,3 +1,9 @@ +openafs (1.8.0~pre5-1ubuntu1.1) bionic; urgency=medium + + * Fix build for Linux 5.0 (LP: #1839890) + + -- Connor Kuehl Mon, 23 Sep 2019 08:49:23 -0700 + openafs (1.8.0~pre5-1ubuntu1) bionic; urgency=medium * Fix build failures for 4.18 kernels. (LP: #1787438) diff -Nru openafs-1.8.0~pre5/debian/patches/series openafs-1.8.0~pre5/debian/patches/series --- openafs-1.8.0~pre5/debian/patches/series 2018-11-21 13:26:23.000000000 +0000 +++ openafs-1.8.0~pre5/debian/patches/series 2019-09-23 15:49:23.000000000 +0000 @@ -1,2 +1,8 @@ 0003-Catch-up-to-roken-s-rename-of-base64-symbols.patch 0001-LINUX-Update-to-Linux-struct-iattr-ia_ctime-to-timespec64-with-4.18 +ubuntu-0001-Linux-4.20-current_kernel_time-is-gone.patch +ubuntu-0002-Linux-4.20-do_settimeofday-is-gone.patch +ubuntu-0003-Linux_5.0-Use-super_block-flags-instead-of-Mount-fla.patch +ubuntu-0004-LINUX-correct-include-for-ktime_get_coarse_real_ts64.patch +ubuntu-0005-Linux_5.0-replace-do_gettimeofday-with-ktime_get_rea.patch +ubuntu-0006-Linux_5.0-replaced-current_kernel_time-with-ktime_ge.patch diff -Nru openafs-1.8.0~pre5/debian/patches/ubuntu-0001-Linux-4.20-current_kernel_time-is-gone.patch openafs-1.8.0~pre5/debian/patches/ubuntu-0001-Linux-4.20-current_kernel_time-is-gone.patch --- openafs-1.8.0~pre5/debian/patches/ubuntu-0001-Linux-4.20-current_kernel_time-is-gone.patch 1970-01-01 00:00:00.000000000 +0000 +++ openafs-1.8.0~pre5/debian/patches/ubuntu-0001-Linux-4.20-current_kernel_time-is-gone.patch 2019-09-23 15:49:23.000000000 +0000 @@ -0,0 +1,70 @@ +From 3c454b39d04f4886536267c211171dae30dc0344 Mon Sep 17 00:00:00 2001 +From: Mark Vitale +Date: Tue, 13 Nov 2018 11:20:09 -0500 +Bug-Ubuntu: 1839890 +Subject: [PATCH] Linux 4.20: current_kernel_time is gone + +With Linux commit 976516404ff3fab2a8caa8bd6f5efc1437fed0b8 'y2038: +remove unused time interfaces' (4.20-rc1), current_kernel_time() has +been removed. + +Many y2038-compliant time APIs were introduced with Linux commit +fb7fcc96a86cfaef0f6dcc0665516aa68611e736 'timekeeping: Standardize on +ktime_get_*() naming' (4.18). According to +Documentation/core-api/timekeeping.rst, a suitable replacement for: + + struct timespec current_kernel_time(void) + +would be: + + void ktime_get_coarse_real_ts64(struct timespec64 *ts)) + +Add an autoconf test and equivalent logic to deal. + +Change-Id: I4ff622ad40cc6d398267276d13493d819b877350 +Reviewed-on: https://gerrit.openafs.org/13391 +Tested-by: Mark Vitale +Reviewed-by: Benjamin Kaduk +--- + src/afs/LINUX/osi_machdep.h | 9 ++++++++- + src/cf/linux-kernel-func.m4 | 4 ++++ + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h +index ce8cabf6e..a1a2f57c0 100644 +--- a/src/afs/LINUX/osi_machdep.h ++++ b/src/afs/LINUX/osi_machdep.h +@@ -75,7 +75,14 @@ + #if defined(HAVE_LINUX_CRED_H) + #include "h/cred.h" + #endif +-#if defined(HAVE_LINUX_CURRENT_KERNEL_TIME) ++ ++#if defined(HAVE_LINUX_KTIME_GET_COARSE_REAL_TS64) ++static inline time_t osi_Time(void) { ++ struct timespec64 xtime; ++ ktime_get_coarse_real_ts64(&xtime); ++ return xtime.tv_sec; ++} ++#elif defined(HAVE_LINUX_CURRENT_KERNEL_TIME) + static inline time_t osi_Time(void) { + struct timespec xtime; + xtime = current_kernel_time(); +diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4 +index 0b17e172e..62fd528d6 100644 +--- a/src/cf/linux-kernel-func.m4 ++++ b/src/cf/linux-kernel-func.m4 +@@ -72,6 +72,10 @@ AC_CHECK_LINUX_FUNC([iter_file_splice_write], + AC_CHECK_LINUX_FUNC([kernel_setsockopt], + [#include ], + [kernel_setsockopt(NULL, 0, 0, NULL, 0);]) ++AC_CHECK_LINUX_FUNC([ktime_get_coarse_real_ts64], ++ [#include ], ++ [struct timespec64 *s; ++ ktime_get_coarse_real_ts64(s);]) + AC_CHECK_LINUX_FUNC([locks_lock_file_wait], + [#include ], + [locks_lock_file_wait(NULL, NULL);]) +-- +2.17.1 + diff -Nru openafs-1.8.0~pre5/debian/patches/ubuntu-0002-Linux-4.20-do_settimeofday-is-gone.patch openafs-1.8.0~pre5/debian/patches/ubuntu-0002-Linux-4.20-do_settimeofday-is-gone.patch --- openafs-1.8.0~pre5/debian/patches/ubuntu-0002-Linux-4.20-do_settimeofday-is-gone.patch 1970-01-01 00:00:00.000000000 +0000 +++ openafs-1.8.0~pre5/debian/patches/ubuntu-0002-Linux-4.20-do_settimeofday-is-gone.patch 2019-09-23 15:49:23.000000000 +0000 @@ -0,0 +1,64 @@ +From aa80f892ec39e2984818090a6bb2047430836ee2 Mon Sep 17 00:00:00 2001 +From: Mark Vitale +Date: Thu, 15 Nov 2018 15:31:37 -0500 +Bug-Ubuntu: 1839890 +Subject: [PATCH] Linux 4.20: do_settimeofday is gone + +With Linux commit 976516404ff3fab2a8caa8bd6f5efc1437fed0b8 'y2038: +remove unused time interfaces', do_settimeofday() is gone. + +However, OpenAFS only calls do_settimeofday() from afs_osi_SetTime(), +which has been dead code since -settime support was removed from afsd +with commit 1d9888be486198868983048eeffabdfef5afa94b 'Remove +-settime/RXAFS_GetTime client support'. + +Instead of fixing afs_osi_SetTime() to use a current Linux API, remove +it as dead code. + +No functional change is incurred by this commit. However, this change +is required in order to build OpenAFS on Linux 4.20. + +Change-Id: I74913deb249de66b0da71539f2596c971f0fd99a +Reviewed-on: https://gerrit.openafs.org/13392 +Reviewed-by: Benjamin Kaduk +Tested-by: Benjamin Kaduk +--- + src/afs/LINUX/osi_misc.c | 12 ------------ + src/afs/LINUX/osi_prototypes.h | 1 - + 2 files changed, 13 deletions(-) + +Index: openafs-1.8.0~pre5/src/afs/LINUX/osi_misc.c +=================================================================== +--- openafs-1.8.0~pre5.orig/src/afs/LINUX/osi_misc.c ++++ openafs-1.8.0~pre5/src/afs/LINUX/osi_misc.c +@@ -29,18 +29,6 @@ int afs_osicred_initialized = 0; + afs_ucred_t afs_osi_cred; + + void +-afs_osi_SetTime(osi_timeval_t * tvp) +-{ +- struct timespec tv; +- tv.tv_sec = tvp->tv_sec; +- tv.tv_nsec = tvp->tv_usec * NSEC_PER_USEC; +- +- AFS_STATCNT(osi_SetTime); +- +- do_settimeofday(&tv); +-} +- +-void + osi_linux_mask(void) + { + SIG_LOCK(current); +Index: openafs-1.8.0~pre5/src/afs/LINUX/osi_prototypes.h +=================================================================== +--- openafs-1.8.0~pre5.orig/src/afs/LINUX/osi_prototypes.h ++++ openafs-1.8.0~pre5/src/afs/LINUX/osi_prototypes.h +@@ -45,7 +45,6 @@ extern void osi_ioctl_init(void); + extern void osi_ioctl_clean(void); + + /* osi_misc.c */ +-extern void afs_osi_SetTime(osi_timeval_t * tvp); + extern int osi_lookupname_internal(char *aname, int followlink, + struct vfsmount **mnt, struct dentry **dpp); + extern int osi_lookupname(char *aname, uio_seg_t seg, int followlink, diff -Nru openafs-1.8.0~pre5/debian/patches/ubuntu-0003-Linux_5.0-Use-super_block-flags-instead-of-Mount-fla.patch openafs-1.8.0~pre5/debian/patches/ubuntu-0003-Linux_5.0-Use-super_block-flags-instead-of-Mount-fla.patch --- openafs-1.8.0~pre5/debian/patches/ubuntu-0003-Linux_5.0-Use-super_block-flags-instead-of-Mount-fla.patch 1970-01-01 00:00:00.000000000 +0000 +++ openafs-1.8.0~pre5/debian/patches/ubuntu-0003-Linux_5.0-Use-super_block-flags-instead-of-Mount-fla.patch 2019-09-23 15:49:23.000000000 +0000 @@ -0,0 +1,47 @@ +From 3969bbca6017eb0ce6e1c3099b135f210403f661 Mon Sep 17 00:00:00 2001 +From: Cheyenne Wills +Date: Thu, 17 Jan 2019 16:00:37 -0700 +Bug-Ubuntu: 1839890 +Subject: [PATCH] Linux_5.0: Use super_block flags instead of Mount flags when + filling sb + +In Kernel commit e262e32d6bde0f77fb0c95d977482fc872c51996 +the mount flags (MS_) were moved from uapi/linux/fs.h to +uapi/linux/mount.h. This caused a compile failure in +src/afs/LINUX/osi_vfsops.c + +The Linux documentation in uapi/linux/mount.h indicates that the MS_ +(mount) flags should only be used when calling sys_mount and filesystems +should use the SB_ (super_block) equivalent. + +src/afs/LINUX/osi_vfsops.c utilized the mount flag MS_NOATIME while +filling the super_block. Changed to use SB_NOATIME (which has the same +numeric value as MS_NOATIME) if available. + +Change-Id: I2b2199de566fbadd45e857b37d24ce63002c7736 +Reviewed-on: https://gerrit.openafs.org/13432 +Tested-by: BuildBot +Reviewed-by: Benjamin Kaduk +--- + src/afs/LINUX/osi_vfsops.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c +index f87d137b3..8bbb5f225 100644 +--- a/src/afs/LINUX/osi_vfsops.c ++++ b/src/afs/LINUX/osi_vfsops.c +@@ -104,7 +104,11 @@ afs_fill_super(struct super_block *sb, void *data, int silent) + __module_get(THIS_MODULE); + + afs_globalVFS = sb; ++#if defined(SB_NOATIME) ++ sb->s_flags |= SB_NOATIME; ++#else + sb->s_flags |= MS_NOATIME; ++#endif + sb->s_blocksize = 1024; + sb->s_blocksize_bits = 10; + sb->s_magic = AFS_VFSMAGIC; +-- +2.17.1 + diff -Nru openafs-1.8.0~pre5/debian/patches/ubuntu-0004-LINUX-correct-include-for-ktime_get_coarse_real_ts64.patch openafs-1.8.0~pre5/debian/patches/ubuntu-0004-LINUX-correct-include-for-ktime_get_coarse_real_ts64.patch --- openafs-1.8.0~pre5/debian/patches/ubuntu-0004-LINUX-correct-include-for-ktime_get_coarse_real_ts64.patch 1970-01-01 00:00:00.000000000 +0000 +++ openafs-1.8.0~pre5/debian/patches/ubuntu-0004-LINUX-correct-include-for-ktime_get_coarse_real_ts64.patch 2019-09-23 15:49:23.000000000 +0000 @@ -0,0 +1,42 @@ +From 10b02075a262dbe802266ea4bcac3936dff5dd23 Mon Sep 17 00:00:00 2001 +From: Mark Vitale +Date: Fri, 18 Jan 2019 17:05:49 -0500 +Bug-Ubuntu: 1839890 +Subject: [PATCH] LINUX: correct include for ktime_get_coarse_real_ts64() + +The include for the ktime_get_coarse_real_ts64() autoconf test is +incorrect; ktime_get_coarse_real_ts64() has always been in linux/ktime.h +(via #include timekeeping.h), not linux/time.h. + +This autoconf test still ran correctly because the OpenAFS build was +inadvertently picking up ktime.h via the default autoconf include path. +Therefore, this commit is needed only to provide documentation and +clarity to future maintainers. + +Introduced as a cut-n-paste error (from the current_kernel_time test) +with commit 3c454b39d04f4886536267c211171dae30dc0344 for Linux 4.20. + +Change-Id: I994b03a1700330756216c7feab0121c82d0f3ee4 +Reviewed-on: https://gerrit.openafs.org/13437 +Tested-by: BuildBot +Reviewed-by: Benjamin Kaduk +--- + src/cf/linux-kernel-func.m4 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4 +index 62fd528d6..551b7b5e1 100644 +--- a/src/cf/linux-kernel-func.m4 ++++ b/src/cf/linux-kernel-func.m4 +@@ -73,7 +73,7 @@ AC_CHECK_LINUX_FUNC([kernel_setsockopt], + [#include ], + [kernel_setsockopt(NULL, 0, 0, NULL, 0);]) + AC_CHECK_LINUX_FUNC([ktime_get_coarse_real_ts64], +- [#include ], ++ [#include ], + [struct timespec64 *s; + ktime_get_coarse_real_ts64(s);]) + AC_CHECK_LINUX_FUNC([locks_lock_file_wait], +-- +2.17.1 + diff -Nru openafs-1.8.0~pre5/debian/patches/ubuntu-0005-Linux_5.0-replace-do_gettimeofday-with-ktime_get_rea.patch openafs-1.8.0~pre5/debian/patches/ubuntu-0005-Linux_5.0-replace-do_gettimeofday-with-ktime_get_rea.patch --- openafs-1.8.0~pre5/debian/patches/ubuntu-0005-Linux_5.0-replace-do_gettimeofday-with-ktime_get_rea.patch 1970-01-01 00:00:00.000000000 +0000 +++ openafs-1.8.0~pre5/debian/patches/ubuntu-0005-Linux_5.0-replace-do_gettimeofday-with-ktime_get_rea.patch 2019-09-23 15:49:23.000000000 +0000 @@ -0,0 +1,65 @@ +From b892fb127815bdf72103ae41ee70aadd87931b0c Mon Sep 17 00:00:00 2001 +From: Cheyenne Wills +Date: Fri, 18 Jan 2019 16:53:58 -0700 +Bug-Ubuntu: 1839890 +Subject: [PATCH] Linux_5.0: replace do_gettimeofday with ktime_get_real_ts64 + +In Kernel commit e4b92b108c6cd6b311e4b6e85d6a87a34599a6e3 the +do_gettimeofday function was removed. + +According to the Linux Documentation/core-api/timekeeping.rst +ktime_get_real_ts64 is the direct replacement for do_gettimeofday + +Updated the macro osi_GetTime to use ktime_get_real_ts64 if it is +available. + +Change-Id: I7fcd49958de83a6a040e40bd310a228247c481b2 +Reviewed-on: https://gerrit.openafs.org/13433 +Reviewed-by: Benjamin Kaduk +Tested-by: BuildBot +--- + src/afs/LINUX/osi_machdep.h | 12 +++++++++--- + src/cf/linux-kernel-func.m4 | 4 ++++ + 2 files changed, 13 insertions(+), 3 deletions(-) + +diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h +index a1a2f57c0..6832c3ee0 100644 +--- a/src/afs/LINUX/osi_machdep.h ++++ b/src/afs/LINUX/osi_machdep.h +@@ -92,9 +92,15 @@ static inline time_t osi_Time(void) { + # define osi_Time() (xtime.tv_sec) + #endif + +- +- +-#ifdef AFS_LINUX_64BIT_KERNEL ++#if defined(HAVE_LINUX_KTIME_GET_REAL_TS64) ++# define osi_GetTime(V) \ ++ do { \ ++ struct timespec64 __afs_tv; \ ++ ktime_get_real_ts64(&__afs_tv); \ ++ (V)->tv_sec = (afs_int32)__afs_tv.tv_sec; \ ++ (V)->tv_usec = (afs_int32)__afs_tv.tv_nsec / 1000; \ ++ } while(0) ++#elif defined(AFS_LINUX_64BIT_KERNEL) + # define osi_GetTime(V) \ + do { \ + struct timeval __afs_tv; \ +diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4 +index 551b7b5e1..34c5fa48e 100644 +--- a/src/cf/linux-kernel-func.m4 ++++ b/src/cf/linux-kernel-func.m4 +@@ -76,6 +76,10 @@ AC_CHECK_LINUX_FUNC([ktime_get_coarse_real_ts64], + [#include ], + [struct timespec64 *s; + ktime_get_coarse_real_ts64(s);]) ++AC_CHECK_LINUX_FUNC([ktime_get_real_ts64], ++ [#include ], ++ [struct timespec64 *s; ++ ktime_get_real_ts64(s);]) + AC_CHECK_LINUX_FUNC([locks_lock_file_wait], + [#include ], + [locks_lock_file_wait(NULL, NULL);]) +-- +2.17.1 + diff -Nru openafs-1.8.0~pre5/debian/patches/ubuntu-0006-Linux_5.0-replaced-current_kernel_time-with-ktime_ge.patch openafs-1.8.0~pre5/debian/patches/ubuntu-0006-Linux_5.0-replaced-current_kernel_time-with-ktime_ge.patch --- openafs-1.8.0~pre5/debian/patches/ubuntu-0006-Linux_5.0-replaced-current_kernel_time-with-ktime_ge.patch 1970-01-01 00:00:00.000000000 +0000 +++ openafs-1.8.0~pre5/debian/patches/ubuntu-0006-Linux_5.0-replaced-current_kernel_time-with-ktime_ge.patch 2019-09-23 15:49:23.000000000 +0000 @@ -0,0 +1,84 @@ +From 21ad6a0c826c150c4227ece50554101641ab4626 Mon Sep 17 00:00:00 2001 +From: Cheyenne Wills +Date: Fri, 18 Jan 2019 17:22:44 -0700 +Bug-Ubuntu: 1839890 +Subject: [PATCH] Linux_5.0: replaced current_kernel_time with + ktime_get_coarse_real_ts64 + +In Kernel commit fb7fcc96a86cfaef0f6dcc0665516aa68611e736 the +current_kernel_time/current_kernel_time64 functions where renamed +and the calling was standardized. + +According to the Linux Documentation/core-api/timekeeping.rst +ktime_get_coarse_real_ts64 is the direct replacement for +current_kernel_time64. Because of year 2038 issues, there is no +replacement for current_kernel_time. + +Updated code that used current_kernel_time to use new name and calling +convention. + +Updated autoconf test that sets IATTR_TAKES_64BIT_TIME as well. + +Change-Id: I607bdcf6f023425975e5bb747e0e780b3d2a7ce5 +Reviewed-on: https://gerrit.openafs.org/13434 +Tested-by: BuildBot +Reviewed-by: Michael Meffie +Reviewed-by: Mark Vitale +Reviewed-by: Benjamin Kaduk +--- + src/afs/LINUX/osi_file.c | 14 ++++++++++---- + src/cf/linux-test4.m4 | 7 ++++++- + 2 files changed, 16 insertions(+), 5 deletions(-) + +Index: openafs-1.8.0~pre5/src/afs/LINUX/osi_file.c +=================================================================== +--- openafs-1.8.0~pre5.orig/src/afs/LINUX/osi_file.c ++++ openafs-1.8.0~pre5/src/afs/LINUX/osi_file.c +@@ -23,11 +23,17 @@ + #include "osi_compat.h" + + #ifndef CURRENT_TIME +-# ifdef IATTR_TAKES_64BIT_TIME +-# define CURRENT_TIME (current_kernel_time64()) ++# if defined(HAVE_LINUX_KTIME_GET_COARSE_REAL_TS64) ++# define AFS_CURRENT_TIME(x) (ktime_get_coarse_real_ts64((x))) + # else +-# define CURRENT_TIME (current_kernel_time()) ++# ifdef IATTR_TAKES_64BIT_TIME ++# define AFS_CURRENT_TIME(x) do {*(x) = current_kernel_time64();} while (0) ++# else ++# define AFS_CURRENT_TIME(x) do {*(x) = current_kernel_time();} while (0) ++# endif + # endif ++#else ++# define AFS_CURRENT_TIME(x) do {*(x) = CURRENT_TIME;} while(0) + #endif + + int cache_fh_type = -1; +@@ -188,7 +194,7 @@ osi_UFSTruncate(struct osi_file *afile, + #endif + newattrs.ia_size = asize; + newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; +- newattrs.ia_ctime = CURRENT_TIME; ++ AFS_CURRENT_TIME(&newattrs.ia_ctime); + + /* avoid notify_change() since it wants to update dentry->d_parent */ + #ifdef HAVE_LINUX_SETATTR_PREPARE +Index: openafs-1.8.0~pre5/src/cf/linux-test4.m4 +=================================================================== +--- openafs-1.8.0~pre5.orig/src/cf/linux-test4.m4 ++++ openafs-1.8.0~pre5/src/cf/linux-test4.m4 +@@ -189,7 +189,12 @@ AC_DEFUN([LINUX_IATTR_64BIT_TIME], [ + [#include + #include ], + [struct iattr _attrs; +- _attrs.ia_ctime = current_kernel_time64();], ++ #if defined(HAVE_LINUX_KTIME_GET_COARSE_REAL_TS64) ++ ktime_get_coarse_real_ts64(&_attrs.ia_ctime); ++ #else ++ _attrs.ia_ctime = current_kernel_time64(); ++ #endif ++ ], + [IATTR_TAKES_64BIT_TIME], + [define if struct iattr->ia_ctime takes struct timespec64], + [])