|
Kmods SIG |
50e2b3 |
From 035779483072ff7854943dc0cbae82c4e0070d15 Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
50e2b3 |
From: Eric Sandeen <sandeen@sandeen.net>
|
|
Kmods SIG |
50e2b3 |
Date: Fri, 1 May 2020 20:34:25 -0500
|
|
Kmods SIG |
50e2b3 |
Subject: [Backport 035779483072] exfat: use iter_file_splice_write
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
Doing copy_file_range() on exfat with a file opened for direct IO leads
|
|
Kmods SIG |
50e2b3 |
to an -EFAULT:
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
# xfs_io -f -d -c "truncate 32768" \
|
|
Kmods SIG |
50e2b3 |
-c "copy_range -d 16384 -l 16384 -f 0" /mnt/test/junk
|
|
Kmods SIG |
50e2b3 |
copy_range: Bad address
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
and the reason seems to be that we go through:
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
default_file_splice_write
|
|
Kmods SIG |
50e2b3 |
splice_from_pipe
|
|
Kmods SIG |
50e2b3 |
__splice_from_pipe
|
|
Kmods SIG |
50e2b3 |
write_pipe_buf
|
|
Kmods SIG |
50e2b3 |
__kernel_write
|
|
Kmods SIG |
50e2b3 |
new_sync_write
|
|
Kmods SIG |
50e2b3 |
generic_file_write_iter
|
|
Kmods SIG |
50e2b3 |
generic_file_direct_write
|
|
Kmods SIG |
50e2b3 |
exfat_direct_IO
|
|
Kmods SIG |
50e2b3 |
do_blockdev_direct_IO
|
|
Kmods SIG |
50e2b3 |
iov_iter_get_pages
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
and land in iterate_all_kinds(), which does "return -EFAULT" for our kvec
|
|
Kmods SIG |
50e2b3 |
iter.
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
Setting exfat's splice_write to iter_file_splice_write fixes this and lets
|
|
Kmods SIG |
50e2b3 |
fsx (which originally detected the problem) run to success from
|
|
Kmods SIG |
50e2b3 |
the xfstests harness.
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
|
|
Kmods SIG |
50e2b3 |
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
|
|
Kmods SIG |
50e2b3 |
---
|
|
Kmods SIG |
50e2b3 |
src/file.c | 13 +++++++------
|
|
Kmods SIG |
50e2b3 |
1 file changed, 7 insertions(+), 6 deletions(-)
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
diff --git a/src/file.c b/src/file.c
|
|
Kmods SIG |
50e2b3 |
index 4f76764165cf6f63a99c5e192ab33685e8e987b7..c9db8eb0cfc3ee267d5e3b051974ceae8de861b5 100644
|
|
Kmods SIG |
50e2b3 |
--- a/src/file.c
|
|
Kmods SIG |
50e2b3 |
+++ b/src/file.c
|
|
Kmods SIG |
50e2b3 |
@@ -348,12 +348,13 @@ int exfat_setattr(struct dentry *dentry, struct iattr *attr)
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
const struct file_operations exfat_file_operations = {
|
|
Kmods SIG |
50e2b3 |
- .llseek = generic_file_llseek,
|
|
Kmods SIG |
50e2b3 |
- .read_iter = generic_file_read_iter,
|
|
Kmods SIG |
50e2b3 |
- .write_iter = generic_file_write_iter,
|
|
Kmods SIG |
50e2b3 |
- .mmap = generic_file_mmap,
|
|
Kmods SIG |
50e2b3 |
- .fsync = generic_file_fsync,
|
|
Kmods SIG |
50e2b3 |
- .splice_read = generic_file_splice_read,
|
|
Kmods SIG |
50e2b3 |
+ .llseek = generic_file_llseek,
|
|
Kmods SIG |
50e2b3 |
+ .read_iter = generic_file_read_iter,
|
|
Kmods SIG |
50e2b3 |
+ .write_iter = generic_file_write_iter,
|
|
Kmods SIG |
50e2b3 |
+ .mmap = generic_file_mmap,
|
|
Kmods SIG |
50e2b3 |
+ .fsync = generic_file_fsync,
|
|
Kmods SIG |
50e2b3 |
+ .splice_read = generic_file_splice_read,
|
|
Kmods SIG |
50e2b3 |
+ .splice_write = iter_file_splice_write,
|
|
Kmods SIG |
50e2b3 |
};
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
const struct inode_operations exfat_file_inode_operations = {
|
|
Kmods SIG |
50e2b3 |
--
|
|
Kmods SIG |
50e2b3 |
2.31.1
|
|
Kmods SIG |
50e2b3 |
|