2019-02-10 09:44:46

by Hou Tao

[permalink] [raw]
Subject: [PATCH] fat: enable .splice_write to support splice on O_DIRECT file

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.

Signed-off-by: Hou Tao <[email protected]>
---
fs/fat/file.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/fat/file.c b/fs/fat/file.c
index 13935ee99e1e..b3bed32946b1 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -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,
};

--
2.16.2.dirty



2019-02-13 09:50:57

by Hou Tao

[permalink] [raw]
Subject: Re: [PATCH] fat: enable .splice_write to support splice on O_DIRECT file

ping ?

On 2019/2/10 17:47, Hou Tao wrote:
> 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.
>
> Signed-off-by: Hou Tao <[email protected]>
> ---
> fs/fat/file.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/fat/file.c b/fs/fat/file.c
> index 13935ee99e1e..b3bed32946b1 100644
> --- a/fs/fat/file.c
> +++ b/fs/fat/file.c
> @@ -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,
> };
>
>


2019-02-13 23:06:11

by OGAWA Hirofumi

[permalink] [raw]
Subject: Re: [PATCH] fat: enable .splice_write to support splice on O_DIRECT file

Hou Tao <[email protected]> writes:

> 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.
>
> Signed-off-by: Hou Tao <[email protected]>
> ---
> fs/fat/file.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/fat/file.c b/fs/fat/file.c
> index 13935ee99e1e..b3bed32946b1 100644
> --- a/fs/fat/file.c
> +++ b/fs/fat/file.c
> @@ -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,
> };

Looks good.

Acked-by: OGAWA Hirofumi <[email protected]>

Thanks.
--
OGAWA Hirofumi <[email protected]>

2019-02-13 23:06:44

by OGAWA Hirofumi

[permalink] [raw]
Subject: Re: [PATCH] fat: enable .splice_write to support splice on O_DIRECT file

OGAWA Hirofumi <[email protected]> writes:

> Hou Tao <[email protected]> writes:
>
>> 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.
>>
>> Signed-off-by: Hou Tao <[email protected]>
>> ---
>> fs/fat/file.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/fs/fat/file.c b/fs/fat/file.c
>> index 13935ee99e1e..b3bed32946b1 100644
>> --- a/fs/fat/file.c
>> +++ b/fs/fat/file.c
>> @@ -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,
>> };
>
> Looks good.
>
> Acked-by: OGAWA Hirofumi <[email protected]>
>
> Thanks.

Forgot to include akpm to addresses.
--
OGAWA Hirofumi <[email protected]>