fat: enable .splice_write to support splice on O_DIRECT file
authorHou Tao <houtao1@huawei.com>
Fri, 8 Mar 2019 00:29:19 +0000 (16:29 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Mar 2019 02:32:01 +0000 (18:32 -0800)
Now splice() on O_DIRECT-opened fat file will return -EFAULT, that is
because the default .splice_write, namely default_file_splice_write(),
will construct an ITER_KVEC iov_iter and dio_refill_pages() in dio path
can not handle it.

Fix it by implementing .splice_write through iter_file_splice_write().

Spotted by xfs-tests generic/091.

Link: http://lkml.kernel.org/r/20190210094754.56355-1-houtao1@huawei.com
Signed-off-by: Hou Tao <houtao1@huawei.com>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/fat/file.c

index 13935ee99e1e53038f458e257d48f11cc7426591..b3bed32946b1d862de5e6f5e42eff37f83f7df9b 100644 (file)
@@ -214,6 +214,7 @@ const struct file_operations fat_file_operations = {
 #endif
        .fsync          = fat_file_fsync,
        .splice_read    = generic_file_splice_read,
+       .splice_write   = iter_file_splice_write,
        .fallocate      = fat_fallocate,
 };