Skip to content

Commit

Permalink
proc mountinfo: make splice available again
Browse files Browse the repository at this point in the history
Since commit 36e2c74 ("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
40be821..b24c30c, 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ó <[email protected]>
Reported-by: Jussi Kivilinna <[email protected]>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=209971
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
torvalds committed Dec 27, 2020
1 parent 52cd5f9 commit 14e3e98
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fs/proc_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,23 +320,26 @@ static int mountstats_open(struct inode *inode, struct file *file)

const struct file_operations proc_mounts_operations = {
.open = mounts_open,
.read = seq_read,
.read_iter = seq_read_iter,
.splice_read = generic_file_splice_read,
.llseek = seq_lseek,
.release = mounts_release,
.poll = mounts_poll,
};

const struct file_operations proc_mountinfo_operations = {
.open = mountinfo_open,
.read = seq_read,
.read_iter = seq_read_iter,
.splice_read = generic_file_splice_read,
.llseek = seq_lseek,
.release = mounts_release,
.poll = mounts_poll,
};

const struct file_operations proc_mountstats_operations = {
.open = mountstats_open,
.read = seq_read,
.read_iter = seq_read_iter,
.splice_read = generic_file_splice_read,
.llseek = seq_lseek,
.release = mounts_release,
};

0 comments on commit 14e3e98

Please sign in to comment.