Since 4.4 linux kernel replaced both posix_lock_file_wait() and
flock_lock_file_wait() by introducing locks_lock_file_wait().
This patch handles the API change.
Linux-commit:
4f6563677ae833baad8003e14353241bc25da4fc
Signed-off-by: Li Dongyang <dongyang.li@anu.edu.au>
Change-Id: I1b9c98c2afcad9da3fb377c3e788b12f20261e9e
Reviewed-on: http://review.whamcloud.com/18729
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
]) # LC_HAVE_CACHE_HEAD_HLIST
#
]) # LC_HAVE_CACHE_HEAD_HLIST
#
+# LC_HAVE_LOCKS_LOCK_FILE_WAIT
+#
+# 4.4 kernel have moved locks API users to
+# locks_lock_inode_wait()
+#
+AC_DEFUN([LC_HAVE_LOCKS_LOCK_FILE_WAIT], [
+LB_CHECK_COMPILE([if 'locks_lock_file_wait' exists],
+locks_lock_file_wait, [
+ #include <linux/fs.h>
+],[
+ locks_lock_file_wait(NULL, NULL);
+],[
+ AC_DEFINE(HAVE_LOCKS_LOCK_FILE_WAIT, 1,
+ [kernel has locks_lock_file_wait])
+])
+]) # LC_HAVE_LOCKS_LOCK_FILE_WAIT
+
+#
# LC_PROG_LINUX
#
# Lustre linux kernel checks
# LC_PROG_LINUX
#
# Lustre linux kernel checks
# 4.3
LC_HAVE_CACHE_HEAD_HLIST
# 4.3
LC_HAVE_CACHE_HEAD_HLIST
+ # 4.4
+ LC_HAVE_LOCKS_LOCK_FILE_WAIT
+
#
AS_IF([test "x$enable_server" != xno], [
LC_FUNC_DEV_SET_RDONLY
#
AS_IF([test "x$enable_server" != xno], [
LC_FUNC_DEV_SET_RDONLY
if (!(flags & LDLM_FL_TEST_LOCK))
file_lock->fl_type = fl_type;
if (!(flags & LDLM_FL_TEST_LOCK))
file_lock->fl_type = fl_type;
+#ifdef HAVE_LOCKS_LOCK_FILE_WAIT
+ if ((rc == 0 || file_lock->fl_type == F_UNLCK) &&
+ !(flags & LDLM_FL_TEST_LOCK))
+ rc2 = locks_lock_file_wait(file, file_lock);
+#else
if ((file_lock->fl_flags & FL_FLOCK) &&
(rc == 0 || file_lock->fl_type == F_UNLCK))
rc2 = flock_lock_file_wait(file, file_lock);
if ((file_lock->fl_flags & FL_FLOCK) &&
(rc == 0 || file_lock->fl_type == F_UNLCK))
rc2 = flock_lock_file_wait(file, file_lock);
(rc == 0 || file_lock->fl_type == F_UNLCK) &&
!(flags & LDLM_FL_TEST_LOCK))
rc2 = posix_lock_file_wait(file, file_lock);
(rc == 0 || file_lock->fl_type == F_UNLCK) &&
!(flags & LDLM_FL_TEST_LOCK))
rc2 = posix_lock_file_wait(file, file_lock);
+#endif /* HAVE_LOCKS_LOCK_FILE_WAIT */
if (rc2 && file_lock->fl_type != F_UNLCK) {
einfo.ei_mode = LCK_NL;
if (rc2 && file_lock->fl_type != F_UNLCK) {
einfo.ei_mode = LCK_NL;