File 0005-LU-12634-llite-lm_compare_owner-removed.patch of Package lustre_2_12

From 9f84ef19ad448782b7f85721035cf316bd1a43dd Mon Sep 17 00:00:00 2001
From: Shaun Tancheff <stancheff@cray.com>
Date: Thu, 8 Aug 2019 22:52:06 -0500
Subject: [PATCH 05/35] LU-12634 llite: lm_compare_owner removed

Linux 5.3 removed lm_compare_owner

kernel-commit: f85d93385e9fe6886a751f647f6812a89bf6bee3

Test-Parameters: trivial
Cray-bug-id: LUS-7689
Signed-off-by: Shaun Tancheff <stancheff@cray.com>
Change-Id: I3aa33df0fcd2443ff8ac5dc8b1c893de92931352
Reviewed-on: https://review.whamcloud.com/35747
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
---
 lustre/autoconf/lustre-core.m4 | 26 +++++++++++++++++++++++++-
 lustre/llite/file.c            |  2 ++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
index ae053b9812d9..0bbab60d9a30 100644
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
@@ -880,7 +880,7 @@ lock_manager_ops_lm_xxx, [
 	#include <linux/fs.h>
 ],[
 	struct lock_manager_operations lm_ops;
-	lm_ops.lm_compare_owner = NULL;
+	lm_ops.lm_notify = NULL;
 ],[
 	AC_DEFINE(HAVE_LM_XXX_LOCK_MANAGER_OPS, 1,
 		[lock-manager ops renamed to lm_xxx])
@@ -3199,6 +3199,29 @@ selinux_is_enabled, [
 EXTRA_KCFLAGS="$tmp_flags"
 ]) # LC_HAS_LINUX_SELINUX_ENABLED
 
+#
+# LC_LM_COMPARE_OWNER_EXISTS
+#
+# kernel 5.3-rc3 commit f85d93385e9fe6886a751f647f6812a89bf6bee3
+# locks: Cleanup lm_compare_owner and lm_owner_key
+# removed lm_compare_owner
+#
+AC_DEFUN([LC_LM_COMPARE_OWNER_EXISTS], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if lock_manager_operations has lm_compare_owner],
+lock_manager_ops_lm_compare_owner, [
+	#include <linux/fs.h>
+],[
+	struct lock_manager_operations lm_ops;
+	lm_ops.lm_compare_owner = NULL;
+],[
+	AC_DEFINE(HAVE_LM_COMPARE_OWNER, 1,
+		[lock_manager_operations has lm_compare_owner])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LC_LM_COMPARE_OWNER_EXISTS
+
 #
 # LC_PROG_LINUX
 #
@@ -3461,6 +3484,7 @@ AC_DEFUN([LC_PROG_LINUX], [
 
 	# 5.0
 	LC_UAPI_LINUX_MOUNT_H
+	LC_LM_COMPARE_OWNER_EXISTS
 
 	# kernel patch to extend integrity interface
 	LC_BIO_INTEGRITY_PREP_FN
diff --git a/lustre/llite/file.c b/lustre/llite/file.c
index a5b80802569a..22b09065f90f 100644
--- a/lustre/llite/file.c
+++ b/lustre/llite/file.c
@@ -3997,6 +3997,7 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
         }
         flock.l_flock.pid = file_lock->fl_pid;
 
+#if defined(HAVE_LM_COMPARE_OWNER) || defined(lm_compare_owner)
 	/* Somewhat ugly workaround for svc lockd.
 	 * lockd installs custom fl_lmops->lm_compare_owner that checks
 	 * for the fl_owner to be the same (which it always is on local node
@@ -4006,6 +4007,7 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
 	 * pointer space for current->files are not intersecting */
 	if (file_lock->fl_lmops && file_lock->fl_lmops->lm_compare_owner)
 		flock.l_flock.owner = (unsigned long)file_lock->fl_pid;
+#endif
 
 	switch (fl_type) {
         case F_RDLCK:
-- 
2.41.0

openSUSE Build Service is sponsored by