2020-02-15 22:03:39

by Pavel Begunkov

[permalink] [raw]
Subject: [PATCH v2 1/5] io_uring: add missing io_req_cancelled()

fallocate_finish() is missing cancellation check. Add it.
It's safe to do that, as only flags setup and sqe fields copy are done
before it gets into __io_fallocate().

Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io_uring.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 5a826017ebb8..7a132be72863 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2517,6 +2517,9 @@ static void io_fallocate_finish(struct io_wq_work **workptr)
struct io_kiocb *nxt = NULL;
int ret;

+ if (io_req_cancelled(req))
+ return;
+
ret = vfs_fallocate(req->file, req->sync.mode, req->sync.off,
req->sync.len);
if (ret < 0)
@@ -2904,6 +2907,7 @@ static void io_close_finish(struct io_wq_work **workptr)
struct io_kiocb *req = container_of(*workptr, struct io_kiocb, work);
struct io_kiocb *nxt = NULL;

+ /* not cancellable, don't do io_req_cancelled() */
__io_close_finish(req, &nxt);
if (nxt)
io_wq_assign_next(workptr, nxt);
--
2.24.0


2020-02-16 17:16:02

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH v2 1/5] io_uring: add missing io_req_cancelled()

On 2/15/20 3:01 PM, Pavel Begunkov wrote:
> fallocate_finish() is missing cancellation check. Add it.
> It's safe to do that, as only flags setup and sqe fields copy are done
> before it gets into __io_fallocate().

Thanks, I added this one to the 5.6 mix.

Going to be sporadic this next week, but I hope I can get to your
5.7 material anyway.

--
Jens Axboe

2020-02-16 19:10:10

by Pavel Begunkov

[permalink] [raw]
Subject: Re: [PATCH v2 1/5] io_uring: add missing io_req_cancelled()

On 16/02/2020 20:15, Jens Axboe wrote:
> On 2/15/20 3:01 PM, Pavel Begunkov wrote:
>> fallocate_finish() is missing cancellation check. Add it.
>> It's safe to do that, as only flags setup and sqe fields copy are done
>> before it gets into __io_fallocate().
>
> Thanks, I added this one to the 5.6 mix.
>
> Going to be sporadic this next week, but I hope I can get to your
> 5.7 material anyway.
>

Sure, there is plenty of time

--
Pavel Begunkov


Attachments:
signature.asc (849.00 B)
OpenPGP digital signature