Great! I can confirm this indeed fixes my reproducer, and the iov_iter now looks sensible in gdb as far as I can judge. Tested-by: Arnout Engelen <arnout@xxxxxxxx> On Mon, Aug 11, 2025, at 09:39, Dominique Martinet via B4 Relay wrote: > From: Dominique Martinet <asmadeus@xxxxxxxxxxxxx> > > After advancing into a folioq it makes more sense to point to the next > slot than at the end of the current slot. > This should not be needed for correctness, but this also happens to > "fix" the 9p bug with iterate_folioq() not copying properly. > > Signed-off-by: Dominique Martinet <asmadeus@xxxxxxxxxxxxx> > --- > lib/iov_iter.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/lib/iov_iter.c b/lib/iov_iter.c > index f9193f952f49945297479483755d68a34c6d4ffe..65c05134ab934e1e0bf5d010fff22983bfe9c680 100644 > --- a/lib/iov_iter.c > +++ b/lib/iov_iter.c > @@ -1032,9 +1032,6 @@ static ssize_t iter_folioq_get_pages(struct iov_iter *iter, > maxpages--; > } > > - if (maxpages == 0 || extracted >= maxsize) > - break; > - > if (iov_offset >= fsize) { > iov_offset = 0; > slot++; > @@ -1043,6 +1040,9 @@ static ssize_t iter_folioq_get_pages(struct iov_iter *iter, > slot = 0; > } > } > + > + if (maxpages == 0 || extracted >= maxsize) > + break; > } > > iter->count = count; > > -- > 2.50.1 > > > -- Arnout Engelen Engelen Open Source https://engelen.eu