mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-03 01:36:52 +09:00
Merge tag 'io_uring-5.16-2021-12-23' of git://git.kernel.dk/linux-block
Pull io_uring fix from Jens Axboe: "Single fix for not clearing kiocb->ki_pos back to 0 for a stream, destined for stable as well" * tag 'io_uring-5.16-2021-12-23' of git://git.kernel.dk/linux-block: io_uring: zero iocb->ki_pos for stream file types
This commit is contained in:
@@ -2891,9 +2891,13 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
req->flags |= io_file_get_flags(file) << REQ_F_SUPPORT_NOWAIT_BIT;
|
||||
|
||||
kiocb->ki_pos = READ_ONCE(sqe->off);
|
||||
if (kiocb->ki_pos == -1 && !(file->f_mode & FMODE_STREAM)) {
|
||||
req->flags |= REQ_F_CUR_POS;
|
||||
kiocb->ki_pos = file->f_pos;
|
||||
if (kiocb->ki_pos == -1) {
|
||||
if (!(file->f_mode & FMODE_STREAM)) {
|
||||
req->flags |= REQ_F_CUR_POS;
|
||||
kiocb->ki_pos = file->f_pos;
|
||||
} else {
|
||||
kiocb->ki_pos = 0;
|
||||
}
|
||||
}
|
||||
kiocb->ki_flags = iocb_flags(file);
|
||||
ret = kiocb_set_rw_flags(kiocb, READ_ONCE(sqe->rw_flags));
|
||||
|
||||
Reference in New Issue
Block a user