for-linus-20191012
-----BEGIN PGP SIGNATURE----- iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAl2iBvAQHGF4Ym9lQGtl cm5lbC5kawAKCRD301j7KXHgpvokEACaUozc0Y2L99CqJcRtoH8cwIAimjKTFSmi UKijO/w11uc9xCIOospkM8iseRbpP/oCIwfYyVROi4LniPB1TSyQJoLF/MELeqIi lOSg8RrXzC22h5+QG3BR5VO55me3MwIXmJLMMWXbh7FAuUg+wepVwHwzZBurd1Pz C1wG8NU758AmqJdSGclUbdLLwTBkR+fXoi2EHfdbsBMqGmdZ5VRzCLx70grDcxq2 S9gt+2+diME6o6p1wko+m9pdhUdEy7epPE50K4SA+DU06I77OZpTdSAPilPyQHei +3HDslzjCyos5/Ay+7hWl42jvyZ+x6GI5VcDLMTcMZsmxLy/WObDB4zcAixJrDV0 c7XWnwCCs2wMXYMsu0ASbkU32mcQ/Ik8CrX0W3/tP1aZBW2LZnOHvXYbybzpbgbo QY47t3jz21uzF5kplBGxqaY1sPmLxp5V0vQmj9eN+Y7T+hiR/UgWKO/5B4CGNJe0 BQkXNl5cZAtqxmSE8AxlpOla7z6beZUljdhFc7K8cMDdhoatRgm2MBh2G9BB1ayo VwHc1qLcvInpQrGiC4l5H/F8jrEs/PglknFSs1wlsav1gXA69J0cHA7LY6Czweaw mkiKr7jA6duBBn6MRUThF5sBMFWYuxp3B/BA4wfDJsSfCmyhWN+OZlsDaEVrzk7o /XK2Ew9R2Q== =PUeL -----END PGP SIGNATURE----- Merge tag 'for-linus-20191012' of git://git.kernel.dk/linux-block Pull io_uring fix from Jens Axboe: "Single small fix for a regression in the sequence logic for linked commands" * tag 'for-linus-20191012' of git://git.kernel.dk/linux-block: io_uring: fix sequence logic for timeout requests
This commit is contained in:
commit
b27528b027
|
@ -415,27 +415,27 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)
|
|||
return ctx;
|
||||
}
|
||||
|
||||
static inline bool io_sequence_defer(struct io_ring_ctx *ctx,
|
||||
struct io_kiocb *req)
|
||||
static inline bool __io_sequence_defer(struct io_ring_ctx *ctx,
|
||||
struct io_kiocb *req)
|
||||
{
|
||||
/* timeout requests always honor sequence */
|
||||
if (!(req->flags & REQ_F_TIMEOUT) &&
|
||||
(req->flags & (REQ_F_IO_DRAIN|REQ_F_IO_DRAINED)) != REQ_F_IO_DRAIN)
|
||||
return false;
|
||||
|
||||
return req->sequence != ctx->cached_cq_tail + ctx->rings->sq_dropped;
|
||||
}
|
||||
|
||||
static struct io_kiocb *__io_get_deferred_req(struct io_ring_ctx *ctx,
|
||||
struct list_head *list)
|
||||
static inline bool io_sequence_defer(struct io_ring_ctx *ctx,
|
||||
struct io_kiocb *req)
|
||||
{
|
||||
if ((req->flags & (REQ_F_IO_DRAIN|REQ_F_IO_DRAINED)) != REQ_F_IO_DRAIN)
|
||||
return false;
|
||||
|
||||
return __io_sequence_defer(ctx, req);
|
||||
}
|
||||
|
||||
static struct io_kiocb *io_get_deferred_req(struct io_ring_ctx *ctx)
|
||||
{
|
||||
struct io_kiocb *req;
|
||||
|
||||
if (list_empty(list))
|
||||
return NULL;
|
||||
|
||||
req = list_first_entry(list, struct io_kiocb, list);
|
||||
if (!io_sequence_defer(ctx, req)) {
|
||||
req = list_first_entry_or_null(&ctx->defer_list, struct io_kiocb, list);
|
||||
if (req && !io_sequence_defer(ctx, req)) {
|
||||
list_del_init(&req->list);
|
||||
return req;
|
||||
}
|
||||
|
@ -443,14 +443,17 @@ static struct io_kiocb *__io_get_deferred_req(struct io_ring_ctx *ctx,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static struct io_kiocb *io_get_deferred_req(struct io_ring_ctx *ctx)
|
||||
{
|
||||
return __io_get_deferred_req(ctx, &ctx->defer_list);
|
||||
}
|
||||
|
||||
static struct io_kiocb *io_get_timeout_req(struct io_ring_ctx *ctx)
|
||||
{
|
||||
return __io_get_deferred_req(ctx, &ctx->timeout_list);
|
||||
struct io_kiocb *req;
|
||||
|
||||
req = list_first_entry_or_null(&ctx->timeout_list, struct io_kiocb, list);
|
||||
if (req && !__io_sequence_defer(ctx, req)) {
|
||||
list_del_init(&req->list);
|
||||
return req;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void __io_commit_cqring(struct io_ring_ctx *ctx)
|
||||
|
|
Loading…
Reference in New Issue