From: Haofeng Li <lihaofeng@kylinos.cn>
To: miklos@szeredi.hu
Cc: fuse-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
joannelkoong@gmail.com, djwong@kernel.org, brauner@kernel.org,
Haofeng Li <lihaofeng@kylinos.cn>
Subject: [PATCH] fuse: honor desc offset in readahead reads
Date: Thu, 16 Jul 2026 17:40:51 +0800 [thread overview]
Message-ID: <20260716094051.412616-1-lihaofeng@kylinos.cn> (raw)
fuse_handle_readahead records non-zero descs[].offset when
iomap skips leading uptodate blocks in a folio, but
fuse_send_readpages built FUSE_READ from folio_pos() alone.
The reply was still copied at descs[0].offset, so wrong
file data was placed into the page cache.
Add descs[0].offset to the request position. Apply the
same correction in fuse_short_read for EOF size updates.
Fixes: 4ea907108a5c ("fuse: use iomap for readahead")
Signed-off-by: Haofeng Li <lihaofeng@kylinos.cn>
---
fs/fuse/file.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index ceada75310b8..11272983c991 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -836,7 +836,8 @@ static void fuse_short_read(struct inode *inode, u64 attr_ver, size_t num_read,
* reached the client fs yet. So the hole is not present there.
*/
if (!fc->writeback_cache) {
- loff_t pos = folio_pos(ap->folios[0]) + num_read;
+ loff_t pos = folio_pos(ap->folios[0]) +
+ ap->descs[0].offset + num_read;
fuse_read_update_size(inode, pos, attr_ver);
}
}
@@ -1057,7 +1058,8 @@ static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file,
struct fuse_file *ff = file->private_data;
struct fuse_mount *fm = ff->fm;
struct fuse_args_pages *ap = &ia->ap;
- loff_t pos = folio_pos(ap->folios[0]);
+ loff_t pos = folio_pos(ap->folios[0]) +
+ ap->descs[0].offset;
ssize_t res;
int err;
--
2.25.1
next reply other threads:[~2026-07-16 9:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 9:40 Haofeng Li [this message]
2026-07-16 18:11 ` Joanne Koong
2026-07-17 3:03 ` Haofeng Li
2026-07-17 3:28 ` [PATCH v2] " Haofeng Li
2026-07-17 8:56 ` Miklos Szeredi
2026-07-17 10:17 ` Horst Birthelmer
2026-07-17 20:33 ` Joanne Koong
2026-07-17 18:37 ` Haofeng Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260716094051.412616-1-lihaofeng@kylinos.cn \
--to=lihaofeng@kylinos.cn \
--cc=brauner@kernel.org \
--cc=djwong@kernel.org \
--cc=fuse-devel@lists.linux.dev \
--cc=joannelkoong@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox