提交 07e35364 编写于 作者: J Jens Axboe 提交者: Zheng Zengkai

random: wire up fops->splice_{read,write}_iter()

stable inclusion
from stable-v5.10.119
commit 18c261e9485a238129b857a8e53d3e2da8ca8246
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5L6BB

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=18c261e9485a238129b857a8e53d3e2da8ca8246

--------------------------------

commit 79025e72 upstream.

Now that random/urandom is using {read,write}_iter, we can wire it up to
using the generic splice handlers.

Fixes: 36e2c742 ("fs: don't allow splice read/write without explicit ops")
Signed-off-by: NJens Axboe <axboe@kernel.dk>
[Jason: added the splice_write path. Note that sendfile() and such still
 does not work for read, though it does for write, because of a file
 type restriction in splice_direct_to_actor(), which I'll address
 separately.]
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NJason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 7996757d
...@@ -1386,6 +1386,8 @@ const struct file_operations random_fops = { ...@@ -1386,6 +1386,8 @@ const struct file_operations random_fops = {
.compat_ioctl = compat_ptr_ioctl, .compat_ioctl = compat_ptr_ioctl,
.fasync = random_fasync, .fasync = random_fasync,
.llseek = noop_llseek, .llseek = noop_llseek,
.splice_read = generic_file_splice_read,
.splice_write = iter_file_splice_write,
}; };
const struct file_operations urandom_fops = { const struct file_operations urandom_fops = {
...@@ -1395,6 +1397,8 @@ const struct file_operations urandom_fops = { ...@@ -1395,6 +1397,8 @@ const struct file_operations urandom_fops = {
.compat_ioctl = compat_ptr_ioctl, .compat_ioctl = compat_ptr_ioctl,
.fasync = random_fasync, .fasync = random_fasync,
.llseek = noop_llseek, .llseek = noop_llseek,
.splice_read = generic_file_splice_read,
.splice_write = iter_file_splice_write,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册