Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

proc mountinfo: make splice available again

Since commit 36e2c7421f02 ("fs: don't allow splice read/write without
explicit ops") we've required that file operation structures explicitly
enable splice support, rather than falling back to the default handlers.

Most /proc files use the indirect 'struct proc_ops' to describe their
file operations, and were fixed up to support splice earlier in commits
40be821d627c..b24c30c67863, but the mountinfo files interact with the
VFS directly using their own 'struct file_operations' and got missed as
a result.

This adds the necessary support for splice to work for /proc/*/mountinfo
and friends.

Reported-by: Joan Bruguera Micó <joanbrugueram@gmail.com>
Reported-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=209971
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+6 -3
+6 -3
fs/proc_namespace.c
··· 320 320 321 321 const struct file_operations proc_mounts_operations = { 322 322 .open = mounts_open, 323 - .read = seq_read, 323 + .read_iter = seq_read_iter, 324 + .splice_read = generic_file_splice_read, 324 325 .llseek = seq_lseek, 325 326 .release = mounts_release, 326 327 .poll = mounts_poll, ··· 329 328 330 329 const struct file_operations proc_mountinfo_operations = { 331 330 .open = mountinfo_open, 332 - .read = seq_read, 331 + .read_iter = seq_read_iter, 332 + .splice_read = generic_file_splice_read, 333 333 .llseek = seq_lseek, 334 334 .release = mounts_release, 335 335 .poll = mounts_poll, ··· 338 336 339 337 const struct file_operations proc_mountstats_operations = { 340 338 .open = mountstats_open, 341 - .read = seq_read, 339 + .read_iter = seq_read_iter, 340 + .splice_read = generic_file_splice_read, 342 341 .llseek = seq_lseek, 343 342 .release = mounts_release, 344 343 };