Commit 474b25a8 authored by Dylan Yudaken's avatar Dylan Yudaken Committed by sanglipeng
Browse files

io_uring: update kiocb->ki_pos at execution time

stable inclusion
from stable-v5.10.165
commit ea528ecac3ae58d8197871b29748eefca7d46be8
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7T7G4

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=ea528ecac3ae58d8197871b29748eefca7d46be8



--------------------------------

commit d34e1e5b upstream.

Update kiocb->ki_pos at execution time rather than in io_prep_rw().
io_prep_rw() happens before the job is enqueued to a worker and so the
offset might be read multiple times before being executed once.

Ensures that the file position in a set of _linked_ SQEs will be only
obtained after earlier SQEs have completed, and so will include their
incremented file position.

Signed-off-by: default avatarDylan Yudaken <dylany@fb.com>
Reviewed-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 8f0e8f4b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment