From d0b3f364b14d484906ab862eebeed43adb36fb40 Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Thu, 20 Oct 2022 23:54:49 -0500 Subject: [PATCH] LU-16258 llite: Explicitly support .splice_write Linux commit v5.9-rc1-6-g36e2c7421f02 fs: don't allow splice read/write without explicit ops Lustre supports splice_write and previously provide handlers for splice_read. Explicitly use iter_file_splice_write, if it exists. Lustre-change: https://review.whamcloud.com/48928 Lustre-commit: c619b6d6a54235cc0e34a65cf5916a632f4011c3 HPE-bug-id: LUS-11259 Signed-off-by: Shaun Tancheff Change-Id: I858688fc9b4dd370b6018c3b134f01e580477b25 Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49058 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 26 +++++++++++++++++++++++++- lustre/llite/file.c | 9 +++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 2fb4ee7..0ba628a 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1909,7 +1909,7 @@ vfs_setxattr, [ __vfs_setxattr(NULL, NULL, NULL, NULL, 0, 0); ],[ AC_DEFINE(HAVE_VFS_SETXATTR, 1, - ['__vfs_setxattr is available]) + ['__vfs_setxattr' is available]) ]) ]) # LC_VFS_SETXATTR @@ -2588,6 +2588,27 @@ EXTRA_KCFLAGS="$tmp_flags" ]) # LC_FSCRYPT_DUMMY_CONTEXT_ENABLED # +# LC_HAVE_ITER_FILE_SPLICE_WRITE +# +# Linux commit v5.9-rc1-6-g36e2c7421f02 +# fs: don't allow splice read/write without explicit ops +# +AC_DEFUN([LC_HAVE_ITER_FILE_SPLICE_WRITE], [ +tmp_flags="$EXTRA_KCFLAGS" +EXTRA_KCFLAGS="-Werror" +LB_CHECK_COMPILE([if 'iter_file_splice_write' exists], +iter_file_splice_write, [ + #include +],[ + (void)iter_file_splice_write(NULL, NULL, NULL, 1, 0); +],[ + AC_DEFINE(HAVE_ITER_FILE_SPLICE_WRITE, 1, + ['iter_file_splice_write' exists]) +]) +EXTRA_KCFLAGS="$tmp_flags" +]) # LC_HAVE_ITER_FILE_SPLICE_WRITE + +# # LC_FSCRYPT_IS_NOKEY_NAME # # Kernel 5.10-rc4 159e1de201b6fca10bfec50405a3b53a561096a8 @@ -2852,6 +2873,9 @@ AC_DEFUN([LC_PROG_LINUX], [ # 5.10 LC_FSCRYPT_IS_NOKEY_NAME + # 5.10 + LC_HAVE_ITER_FILE_SPLICE_WRITE + # 5.12 LC_HAVE_USER_NAMESPACE_ARG diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 8e26050..db556b5 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -5616,6 +5616,9 @@ static const struct file_operations ll_file_operations = { #else .splice_read = pcc_file_splice_read, #endif +#ifdef HAVE_ITER_FILE_SPLICE_WRITE + .splice_write = iter_file_splice_write, +#endif .fsync = ll_fsync, .flush = ll_flush, .fallocate = ll_fallocate, @@ -5645,6 +5648,9 @@ static const struct file_operations ll_file_operations_flock = { #else .splice_read = pcc_file_splice_read, #endif +#ifdef HAVE_ITER_FILE_SPLICE_WRITE + .splice_write = iter_file_splice_write, +#endif .fsync = ll_fsync, .flush = ll_flush, .flock = ll_file_flock, @@ -5677,6 +5683,9 @@ static const struct file_operations ll_file_operations_noflock = { #else .splice_read = pcc_file_splice_read, #endif +#ifdef HAVE_ITER_FILE_SPLICE_WRITE + .splice_write = iter_file_splice_write, +#endif .fsync = ll_fsync, .flush = ll_flush, .flock = ll_file_noflock, -- 1.8.3.1