diff options
| author | Miklos Szeredi <mszeredi@redhat.com> | 2026-11-03 16:31:39 +0100 |
|---|---|---|
| committer | Miklos Szeredi <mszeredi@redhat.com> | 2026-11-19 18:25:58 +0100 |
| commit | ef925fd700ea8f64ce34225f9fea1d20ae3f3cab (patch) | |
| tree | 05f2f3ef73e0bcebcc825021580135e1feecf6b0 /rust/kernel/alloc/allocator | |
| parent | 9ea515bbfb8c02c621af02410dd2e5234130126d (diff) | |
fuse: derive short read EOF from the request offset
fuse_short_read() computed the new file size as
folio_pos(ap->folios[0]) + num_read
which assumes that the read started at the beginning of the first folio.
That is not true in general: fuse_do_readfolio() may be asked to read part
of a folio only, in which case it passes the offset within the folio in
descs[0].offset and correctly adds it to the position of the request. If
such a read came back short, the EOF derived from it would be
descs[0].offset bytes too low and i_size would be truncated accordingly.
fuse_send_readpages() made the same assumption for the position of the
read request itself, even though fuse_copy_folios() fills the first folio
starting at descs[0].offset.
Neither is reachable today: sub-folio reads only originate from the iomap
buffered write path, which requires fc->writeback_cache, and in that case
fuse_short_read() does not update the size at all; readahead always starts
on a folio boundary. Don't rely on that, though.
Add fuse_folios_pos() to compute the position of the first byte covered by
a folio array and use it for both read requests. Make fuse_short_read()
take the fuse_io_args and derive EOF from ia->read.in.offset, i.e. the
offset the request was actually sent with, so that the two can no longer
disagree. fuse_do_readfolio() now keeps the attribute version in
ia.read.attr_ver, as the readahead path already did.
No functional change intended.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'rust/kernel/alloc/allocator')
0 files changed, 0 insertions, 0 deletions
