Whamcloud - gitweb
LU-9183 libcfs: handle get_user_pages() with gup_flags 17/25817/10
authorDmitry Eremin <dmitry.eremin@intel.com>
Thu, 2 Mar 2017 19:39:37 +0000 (22:39 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 28 Apr 2017 20:35:56 +0000 (20:35 +0000)
In commit c8fe4609827aedc9c4b45de80e7cdc8ccfa8541b the arguments
write/force for get_user_pages() were replaced with gup_flags.

Change-Id: I64b3e69ee736d1f3be48f2c4c8fe1af1dc14e857
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-on: https://review.whamcloud.com/25817
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/autoconf/lustre-libcfs.m4
libcfs/libcfs/linux/linux-curproc.c

index c7199f5..db240c2 100644 (file)
@@ -555,6 +555,23 @@ stacktrace_ops, [
 ]) # LIBCFS_STACKTRACE_OPS
 
 #
+# Kernel version 4.9 commit 768ae309a96103ed02eb1e111e838c87854d8b51
+# mm: replace get_user_pages() write/force parameters with gup_flags
+#
+AC_DEFUN([LIBCFS_GET_USER_PAGES_GUP_FLAGS], [
+LB_CHECK_COMPILE([if 'get_user_pages()' takes gup_flags in arguments],
+get_user_pages_gup_flags, [
+       #include <linux/mm.h>
+],[
+       int rc;
+       rc = get_user_pages(0, 0, FOLL_WRITE, NULL, NULL);
+],[
+       AC_DEFINE(HAVE_GET_USER_PAGES_GUP_FLAGS, 1,
+               [get_user_pages takes gup_flags in arguments])
+])
+]) # LIBCFS_GET_USER_PAGES_GUP_FLAGS
+
+#
 # LIBCFS_PROG_LINUX
 #
 # LibCFS linux kernel checks
@@ -612,6 +629,8 @@ LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
 LIBCFS_GET_USER_PAGES_6ARG
 # 4.8
 LIBCFS_STACKTRACE_OPS
+# 4.9
+LIBCFS_GET_USER_PAGES_GUP_FLAGS
 ]) # LIBCFS_PROG_LINUX
 
 #
index b846627..7b2e46e 100644 (file)
@@ -149,7 +149,9 @@ static int cfs_access_process_vm(struct task_struct *tsk,
                int bytes, rc, offset;
                void *maddr;
 
-#ifdef HAVE_GET_USER_PAGES_6ARG
+#if defined(HAVE_GET_USER_PAGES_GUP_FLAGS)
+               rc = get_user_pages(addr, 1, write ? FOLL_WRITE : 0, &page, &vma);
+#elif defined(HAVE_GET_USER_PAGES_6ARG)
                rc = get_user_pages(addr, 1, write, 1, &page, &vma);
 #else
                rc = get_user_pages(tsk, mm, addr, 1, write, 1, &page, &vma);