Whamcloud - gitweb
LU-11838 kernel: harden current_time autoconf test 63/33963/2
authorJames Simmons <uja.ornl@yahoo.com>
Mon, 7 Jan 2019 16:46:38 +0000 (11:46 -0500)
committerOleg Drokin <green@whamcloud.com>
Wed, 23 Jan 2019 09:18:16 +0000 (09:18 +0000)
In newer kernels CURRENT_TIME was replaced by current_time(). The
return value of current_time() was struct timespec but to support
time after 2038 the return value was changed to struct timespec64.
This change broke the autoconf test. The solution is to use one
of the struct iattr field in the autoconf test since it hides
the return value type.

Test-Parameters: trivial

Change-Id: I95abd2cd2b777f99cbf6ab78370ee2171e5fca67
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/33963
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Ben Evans <bevans@cray.com>
lustre/autoconf/lustre-core.m4

index f4d6a25..227fd38 100644 (file)
@@ -2899,7 +2899,9 @@ LB_CHECK_COMPILE([if CURRENT_TIME has been replaced with current_time],
 current_time, [
        #include <linux/fs.h>
 ],[
 current_time, [
        #include <linux/fs.h>
 ],[
-       struct timespec ts = current_time(NULL);
+       struct iattr attr;
+
+       attr.ia_atime = current_time(NULL);
 ],[
        AC_DEFINE(HAVE_CURRENT_TIME, 1,
                [current_time() has replaced CURRENT_TIME])
 ],[
        AC_DEFINE(HAVE_CURRENT_TIME, 1,
                [current_time() has replaced CURRENT_TIME])