io_uring: don't convert to jiffies for waiting on timeouts
authorJens Axboe <axboe@kernel.dk>
Mon, 21 Feb 2022 12:49:30 +0000 (05:49 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 Mar 2022 10:47:48 +0000 (11:47 +0100)
commit7c83437fb3aeda489638304edf7c386b16e7cc5b
tree3c28672342ebf9af4f9818d3b86f336005b3b6b9
parent6d20ff677349240313d9110fc8076a9d729fafbf
io_uring: don't convert to jiffies for waiting on timeouts

commit 228339662b398a59b3560cd571deb8b25b253c7e upstream.

If an application calls io_uring_enter(2) with a timespec passed in,
convert that timespec to ktime_t rather than jiffies. The latter does
not provide the granularity the application may expect, and may in
fact provided different granularity on different systems, depending
on what the HZ value is configured at.

Turn the timespec into an absolute ktime_t, and use that with
schedule_hrtimeout() instead.

Link: https://github.com/axboe/liburing/issues/531
Cc: stable@vger.kernel.org
Reported-by: Bob Chen <chenbo.chen@alibaba-inc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/io_uring.c