From 0c080f1e8791b6b1aebba9d2165235122697db68 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Thu, 30 Jul 2015 12:04:41 -0400 Subject: [PATCH] LU-6215 llite: handle new_sync_[read|write] removal In newer linux kernel version the file read/write API have been moving to using struct iov_iter. To continue supporting the old API new wrapper functions were created, new_sync_*, which allowed the use of the new API's to support the old API's. For the linux 4.1 kernel those new_sync_* are used internally so they are no longer exposed to any file systems. If a file system wants to use the "old" api they need to call vfs_[write|read]. Update lustre to handle this change. The upstream commit that made new_sync_* internal was: Linux commit: 5d5d568975307877e9195f5305f4240e506a2807 Signed-off-by: James Simmons Change-Id: Ibf69d25af8a7d5cda00c5b1be4757ec369e8e814 Reviewed-on: http://review.whamcloud.com/15165 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 12 ++++++++++++ lustre/llite/file.c | 12 +++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 2ce6386..0d83e19 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1823,6 +1823,17 @@ iov_iter_rw, [ ]) # LC_IOV_ITER_RW # +# LC_HAVE_SYNC_READ_WRITE +# +# 4.1 new_sync_[read|write] no longer exported +# +AC_DEFUN([LC_HAVE_SYNC_READ_WRITE], [ +LB_CHECK_EXPORT([new_sync_read], [fs/read_write.c], + [AC_DEFINE(HAVE_SYNC_READ_WRITE, 1, + [new_sync_[read|write] is exported by the kernel])]) +]) # LC_HAVE_SYNC_READ_WRITE + +# # LC_PROG_LINUX # # Lustre linux kernel checks @@ -1971,6 +1982,7 @@ AC_DEFUN([LC_PROG_LINUX], [ # 4.1.0 LC_IOV_ITER_RW + LC_HAVE_SYNC_READ_WRITE # AS_IF([test "x$enable_server" != xno], [ diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 92640cc..97ad193 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -3467,9 +3467,11 @@ int ll_inode_permission(struct inode *inode, int mask, struct nameidata *nd) /* -o localflock - only provides locally consistent flock locks */ struct file_operations ll_file_operations = { #ifdef HAVE_FILE_OPERATIONS_READ_WRITE_ITER +# ifdef HAVE_SYNC_READ_WRITE .read = new_sync_read, - .read_iter = ll_file_read_iter, .write = new_sync_write, +# endif + .read_iter = ll_file_read_iter, .write_iter = ll_file_write_iter, #else /* !HAVE_FILE_OPERATIONS_READ_WRITE_ITER */ .read = ll_file_read, @@ -3489,9 +3491,11 @@ struct file_operations ll_file_operations = { struct file_operations ll_file_operations_flock = { #ifdef HAVE_FILE_OPERATIONS_READ_WRITE_ITER +# ifdef HAVE_SYNC_READ_WRITE .read = new_sync_read, - .read_iter = ll_file_read_iter, .write = new_sync_write, +# endif /* HAVE_SYNC_READ_WRITE */ + .read_iter = ll_file_read_iter, .write_iter = ll_file_write_iter, #else /* !HAVE_FILE_OPERATIONS_READ_WRITE_ITER */ .read = ll_file_read, @@ -3514,9 +3518,11 @@ struct file_operations ll_file_operations_flock = { /* These are for -o noflock - to return ENOSYS on flock calls */ struct file_operations ll_file_operations_noflock = { #ifdef HAVE_FILE_OPERATIONS_READ_WRITE_ITER +# ifdef HAVE_SYNC_READ_WRITE .read = new_sync_read, - .read_iter = ll_file_read_iter, .write = new_sync_write, +# endif /* HAVE_SYNC_READ_WRITE */ + .read_iter = ll_file_read_iter, .write_iter = ll_file_write_iter, #else /* !HAVE_FILE_OPERATIONS_READ_WRITE_ITER */ .read = ll_file_read, -- 1.8.3.1