Re: [PATCH v3 5/5] shmem, overlayfs, coda, tty, proc, kernfs, random: Fix splice-read
From: Greg Kroah-Hartman
Date: Tue Feb 14 2023 - 03:54:20 EST
- Next message: Sergio Paracuellos: "Re: [PATCH v6 3/3] watchdog: mt7621-wdt: avoid ralink architecture dependent code"
- Previous message: Jens Wiklander: "Re: [PATCH v2 0/4] Remove get_kernel_pages()"
- In reply to: David Howells: "[PATCH v3 5/5] shmem, overlayfs, coda, tty, proc, kernfs, random: Fix splice-read"
- Next in thread: Daniel Golle: "Re: [PATCH v3 5/5] shmem, overlayfs, coda, tty, proc, kernfs, random: Fix splice-read"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Feb 14, 2023 at 08:37:10AM +0000, David Howells wrote:
> The new filemap_splice_read() has an implicit expectation via
> filemap_get_pages() that ->read_folio() exists if ->readahead() doesn't
> fully populate the pagecache of the file it is reading from[1], potentially
> leading to a jump to NULL if this doesn't exist.
>
> A filesystem or driver shouldn't suffer from this if:
>
> - It doesn't set ->splice_read()
> - It implements ->read_folio()
> - It implements its own ->splice_read()
>
> Note that some filesystems set generic_file_splice_read() and
> generic_file_read_iter() but don't set ->read_folio(). g_f_read_iter()
> will fall back to filemap_read_iter() which looks like it should suffer
> from the same issue.
>
> Certain drivers, can just use direct_splice_read() rather than
> generic_file_splice_read() as that creates an output buffer and then just
> calls their ->read_iter() function:
>
> - random & urandom
> - tty
> - kernfs
> - proc
> - proc_namespace
>
> Stacked filesystems just need to pass the operation down a layer:
>
> - coda
> - overlayfs
>
> And finally, there's shmem (used in tmpfs, ramfs, rootfs). This needs its
> own splice-read implementation, based on filemap_splice_read(), but able to
> paste in zero_page when there's a page missing.
>
> Fixes: d9722a475711 ("splice: Do splice read from a buffered file without using ITER_PIPE")
> Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
> cc: Daniel Golle <daniel@xxxxxxxxxxxxxx>
> cc: Guenter Roeck <groeck7@xxxxxxxxx>
> cc: Christoph Hellwig <hch@xxxxxx>
> cc: Jens Axboe <axboe@xxxxxxxxx>
> cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> cc: John Hubbard <jhubbard@xxxxxxxxxx>
> cc: David Hildenbrand <david@xxxxxxxxxx>
> cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
> cc: Miklos Szeredi <miklos@xxxxxxxxxx>
> cc: Hugh Dickins <hughd@xxxxxxxxxx>
> cc: Jan Harkes <jaharkes@xxxxxxxxxx>
> cc: Arnd Bergmann <arnd@xxxxxxxx>
> cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> cc: coda@xxxxxxxxxx
> cc: codalist@xxxxxxxxxxxxxxx
> cc: linux-unionfs@xxxxxxxxxxxxxxx
> cc: linux-block@xxxxxxxxxxxxxxx
> cc: linux-fsdevel@xxxxxxxxxxxxxxx
> cc: linux-mm@xxxxxxxxx
> Link: https://lore.kernel.org/r/Y+pdHFFTk1TTEBsO@xxxxxxxxxxxxxx/ [1]
> ---
Acked-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
- Next message: Sergio Paracuellos: "Re: [PATCH v6 3/3] watchdog: mt7621-wdt: avoid ralink architecture dependent code"
- Previous message: Jens Wiklander: "Re: [PATCH v2 0/4] Remove get_kernel_pages()"
- In reply to: David Howells: "[PATCH v3 5/5] shmem, overlayfs, coda, tty, proc, kernfs, random: Fix splice-read"
- Next in thread: Daniel Golle: "Re: [PATCH v3 5/5] shmem, overlayfs, coda, tty, proc, kernfs, random: Fix splice-read"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]