On 9/9/21 3:19 PM, Jens Axboe wrote: >> That "req->result" is once again the *original* length, and the above >> code once again mis-handles the case of "oh, the iov got truncated >> because of some IO limit". >> >> So I've pulled this, but I think it is >> >> (a) ugly nasty >> >> (b) incomplete and misses a case >> >> and needs more thought. At the VERY least it needs that >> iov_iter_reexpand() in io_resubmit_prep() too, I think. >> >> I'd like the comments expanded too. In particular that >> >> /* some cases will consume bytes even on error returns */ > > That comment is from me, and it goes back a few years. IIRC, it was the > iomap or xfs code that I hit this with, but honestly I don't remember > all the details at this point. I can try and play with it and see if it > still reproduces. OK, one that I immediately found is just doing O_DIRECT to a block device or file on XFS. As pages are mapped and added, the iov_iter is advanced. If we then go and submit and get -EAGAIN, for example, then we return with what we mapped already consumed. -- Jens Axboe