-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linux 6.5: Replace generic_file_splice_read with filemap_splice_read #15155
Linux 6.5: Replace generic_file_splice_read with filemap_splice_read #15155
Conversation
The generic_file_splice_read function was removed in Linux 6.5 in favor of filemap_splice_read. Add an autoconf test for filemap_splice_read and use it if it is found as the handler for .splice_read in the file_operations struct. Additionally, ITER_PIPE was removed in 6.5. This change removes the ITER_* macros that OpenZFS doesn't use from being tested in config/kernel-vfs-iov_iter.m4. The removal of ITER_PIPE was causing the test to fail, which also affected the code responsible for setting the .splice_read handler, above. That behavior caused run-time panics on Linux 6.5. Signed-off-by: Coleman Kane <[email protected]>
Alternatively, this could be written to test for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you look at the comment in zfs_uiomove_iter()
in module/os/linux/zfs/zfs_uio.c
about returning the value of EFAULT
as it will be converted to EAGAIN
by generic_file_splice_read()
?
When I was looking at filemap_splice_read()
I noticed it just returned the error without converting the error of EFAULT
. We may need to also update this part of the code with the check to just return EAGAIN
? Not sure though without spending more time looking at what error should be returned from zfs_uiomove_iter()
in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks to me like filemap_splice_read()
will handle this correctly.
…e_read The generic_file_splice_read function was removed in Linux 6.5 in favor of filemap_splice_read. Add an autoconf test for filemap_splice_read and use it if it is found as the handler for .splice_read in the file_operations struct. Additionally, ITER_PIPE was removed in 6.5. This change removes the ITER_* macros that OpenZFS doesn't use from being tested in config/kernel-vfs-iov_iter.m4. The removal of ITER_PIPE was causing the test to fail, which also affected the code responsible for setting the .splice_read handler, above. That behavior caused run-time panics on Linux 6.5. Reviewed-by: Brian Atkinson <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Coleman Kane <[email protected]> Closes openzfs#15155
…e_read The generic_file_splice_read function was removed in Linux 6.5 in favor of filemap_splice_read. Add an autoconf test for filemap_splice_read and use it if it is found as the handler for .splice_read in the file_operations struct. Additionally, ITER_PIPE was removed in 6.5. This change removes the ITER_* macros that OpenZFS doesn't use from being tested in config/kernel-vfs-iov_iter.m4. The removal of ITER_PIPE was causing the test to fail, which also affected the code responsible for setting the .splice_read handler, above. That behavior caused run-time panics on Linux 6.5. Reviewed-by: Brian Atkinson <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Coleman Kane <[email protected]> Closes openzfs#15155
…e_read The generic_file_splice_read function was removed in Linux 6.5 in favor of filemap_splice_read. Add an autoconf test for filemap_splice_read and use it if it is found as the handler for .splice_read in the file_operations struct. Additionally, ITER_PIPE was removed in 6.5. This change removes the ITER_* macros that OpenZFS doesn't use from being tested in config/kernel-vfs-iov_iter.m4. The removal of ITER_PIPE was causing the test to fail, which also affected the code responsible for setting the .splice_read handler, above. That behavior caused run-time panics on Linux 6.5. Reviewed-by: Brian Atkinson <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Coleman Kane <[email protected]> Closes #15155
…e_read The generic_file_splice_read function was removed in Linux 6.5 in favor of filemap_splice_read. Add an autoconf test for filemap_splice_read and use it if it is found as the handler for .splice_read in the file_operations struct. Additionally, ITER_PIPE was removed in 6.5. This change removes the ITER_* macros that OpenZFS doesn't use from being tested in config/kernel-vfs-iov_iter.m4. The removal of ITER_PIPE was causing the test to fail, which also affected the code responsible for setting the .splice_read handler, above. That behavior caused run-time panics on Linux 6.5. Reviewed-by: Brian Atkinson <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Coleman Kane <[email protected]> Closes #15155
…e_read The generic_file_splice_read function was removed in Linux 6.5 in favor of filemap_splice_read. Add an autoconf test for filemap_splice_read and use it if it is found as the handler for .splice_read in the file_operations struct. Additionally, ITER_PIPE was removed in 6.5. This change removes the ITER_* macros that OpenZFS doesn't use from being tested in config/kernel-vfs-iov_iter.m4. The removal of ITER_PIPE was causing the test to fail, which also affected the code responsible for setting the .splice_read handler, above. That behavior caused run-time panics on Linux 6.5. Reviewed-by: Brian Atkinson <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Coleman Kane <[email protected]> Closes openzfs#15155
The generic_file_splice_read function was removed in Linux 6.5 in favor of filemap_splice_read. Add an autoconf test for filemap_splice_read and use it if it is found as the handler for .splice_read in the file_operations struct. Additionally, ITER_PIPE was removed in 6.5. This change removes the ITER_* macros that OpenZFS doesn't use from being tested in config/kernel-vfs-iov_iter.m4. The removal of ITER_PIPE was causing the test to fail, which also affected the code responsible for setting the .splice_read handler, above. That behavior caused run-time panics on Linux 6.5.
Motivation and Context
When running ZFS on 6.5rc*, a run-time panic occurs with the following stack trace:
It turns out that
ITER_PIPE
was removed in 6.5, and this in turn causes one of the tests settingHAVE_VFS_IOV_ITER
to result in a false-negative duringconfigure
. This results in not assigning the.splice_read
member ofstruct file_operations
inmodule/os/linux/zfs/zpl_file.c
, which was likely the cause of the memory access error above. Additionally, this struct member has been set togeneric_file_splice_read
up until now, but that function has also been removed in Linux 6.5. It has been superseded byfilemap_splice_read
. This additional regression was masked by theconfigure
test failure due to missingITER_PIPE
.Description
The only
ITER_*
macro used by OpenZFS isITER_KVEC
, so instead of trying to set anint
with all possible bits set in the test, I changed it to only try setting theITER_KVEC
bit, and succeed if that works. In the future, if the remaining ones (or any future ones) are used by the code, they can be added to this test inconfig/kernel-vfs-iov_iter.m4
. As far as I can tell, we shouldn't be failing the build if macros we don't use are removed in the kernel.Add a new
configure
test for the presence offilemap_splice_read
and ensure that it can be assigned tofile_operations.splice_read
without any type conflicts. This tests for the existence of the function, and also ensures that its type definition matches the handler instruct file_operations
, the context in which we rely upon it.Finally, add a
#ifdef
in themodule/os/linux/zfs/zpl_file.c
code that will assignfile_operations.splice_read
tofilemap_splice_read
if the latter is found byconfigure
.How Has This Been Tested?
Build-tested and Run-tested on Linux 6.5rc1
Types of changes
Checklist:
Signed-off-by
.