About whether we should support the alignment in the generic_file_splice_read() ?

From: Jason Xing
Date: Fri Nov 29 2019 - 02:51:04 EST


Hi all,

Sorry to send this email to you all. I recently noticed there're some
incompatibilities existing in the generic_file_splice_read() function
between 3.X and 4.X kernel. The result will goes wrong if we're using
sendfile() with unaligned offset in 4.X/5.X kernel. But if we do the
same in 3.X kernel, it will surely return success.

Here is the call trace:
1. Using sendfile() with unaligned offset
2. Then it runs into the kernel:
sendfile64()->do_sendfile()->do_splice_direct()->splice_direct_to_actor()->do_splice_to()->splice_read()
3. splice_read() calls the __generic_file_splice_read() in 3.X kernel,
generic_file_splice_read() in 4.X kernel.

In 3.X kernel, this function handles the alignment by using the
PAGE_SHIFT and PAGE_MASK. However, after applying this
commit(82c156f853840645604acd7c2cebcb75ed1b6652) the 4.X no longer
supports the unaligned data.

I'm wondering should we add the alignment process code back again?
Does anyone have idea about why this part got removed? Any information
and suggestions are welcome:-)

Thanks,
Jason