From: Shaun Tancheff Date: Fri, 21 Oct 2022 04:54:49 +0000 (-0500) Subject: LU-16258 llite: Explicitly support .splice_write X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=1c61e14937e44e03383331128b7ea14b63923abe;p=fs%2Flustre-release.git 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-on: https://review.whamcloud.com/c/ex/lustre-release/+/49047 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index f718d93..e27ef28 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1834,7 +1834,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 @@ -2503,6 +2503,27 @@ EXTRA_KCFLAGS="$tmp_flags" ]) # LC_FORCE_UACCESS_BEGIN # +# 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_SUPPORT # # 5.4 introduced fscrypt encryption policies v2 @@ -2775,6 +2796,9 @@ AC_DEFUN([LC_PROG_LINUX], [ # 5.10 LC_FORCE_UACCESS_BEGIN + # 5.10 + LC_HAVE_ITER_FILE_SPLICE_WRITE + # 5.12 LC_HAVE_USER_NAMESPACE_ARG LC_HAVE_FILEATTR_OPS diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 24b205c..a173134 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -5800,6 +5800,9 @@ 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, @@ -5829,6 +5832,9 @@ 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, @@ -5861,6 +5867,9 @@ 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,