2020-12-01 15:29:13

by Toke Høiland-Jørgensen

[permalink] [raw]
Subject: Re: [V9fs-developer] [PATCH] fs: 9p: add generic splice_read file operations

Dominique Martinet <[email protected]> writes:

> Dominique Martinet wrote on Tue, Dec 01, 2020:
>> > Since generic_file_splice_read() seems to just implement splice_read in
>> > terms of the read_iter operation, I simply added the generic implementation
>> > to the file operations, which fixed the error I was seeing. A quick grep
>> > indicates that this is what most other file systems do as well.
>>
>> Good catch, might as well do that.
>> I'm surprised you didn't hit the same problem with splice_write?
>>
>> I see iter_file_splice_write being used for it on many filesystems,
>> it's probably better to add both?
>
> Yeah, I confirm both are needed (the second for the pipe -> fs side)

Yeah, makes sense; I was only testing with a very specific use case
where a file is being passed to the kernel with sendfile().

> This made me test copy_file_range, and it works with both as well (used
> not to)
>
> interestingly on older kernels this came as default somehow? I have
> splice working on 5.4.67 :/ so this broke somewhat recently...

Huh, no idea; this is my first time digging into filesystem code, I
normally do networking and BPF :)

> I'll add an extra patch with the second and take your patch.
> Thanks!

Awesome, thanks!

-Toke


2020-12-01 15:43:34

by Dominique Martinet

[permalink] [raw]
Subject: Re: [V9fs-developer] [PATCH] fs: 9p: add generic splice_read file operations

Toke Høiland-Jørgensen wrote on Tue, Dec 01, 2020:
> > This made me test copy_file_range, and it works with both as well (used
> > not to)
> >
> > interestingly on older kernels this came as default somehow? I have
> > splice working on 5.4.67 :/ so this broke somewhat recently...
>
> Huh, no idea; this is my first time digging into filesystem code, I
> normally do networking and BPF :)

In case anyone else wants to know, this broke in 5.10-rc1 with
36e2c7421f02 ("fs: don't allow splice read/write without explicit ops")

So really a recent regression, good catch :)

--
Dominique

2020-12-01 20:41:51

by Toke Høiland-Jørgensen

[permalink] [raw]
Subject: Re: [V9fs-developer] [PATCH] fs: 9p: add generic splice_read file operations

Dominique Martinet <[email protected]> writes:

> Toke Høiland-Jørgensen wrote on Tue, Dec 01, 2020:
>> > This made me test copy_file_range, and it works with both as well (used
>> > not to)
>> >
>> > interestingly on older kernels this came as default somehow? I have
>> > splice working on 5.4.67 :/ so this broke somewhat recently...
>>
>> Huh, no idea; this is my first time digging into filesystem code, I
>> normally do networking and BPF :)
>
> In case anyone else wants to know, this broke in 5.10-rc1 with
> 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops")
>
> So really a recent regression, good catch :)

Thanks - and what a lucky coincidence that I happened upon this now so
it can be fixed before 5.10-final :)

-Toke