Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+23 -20
+23 -20
fs/io_uring.c
··· 415 415 return ctx; 416 416 } 417 417 418 - static inline bool io_sequence_defer(struct io_ring_ctx *ctx, 419 - struct io_kiocb *req) 418 + static inline bool __io_sequence_defer(struct io_ring_ctx *ctx, 419 + struct io_kiocb *req) 420 420 { 421 - /* timeout requests always honor sequence */ 422 - if (!(req->flags & REQ_F_TIMEOUT) && 423 - (req->flags & (REQ_F_IO_DRAIN|REQ_F_IO_DRAINED)) != REQ_F_IO_DRAIN) 424 - return false; 425 - 426 421 return req->sequence != ctx->cached_cq_tail + ctx->rings->sq_dropped; 427 422 } 428 423 429 - static struct io_kiocb *__io_get_deferred_req(struct io_ring_ctx *ctx, 430 - struct list_head *list) 424 + static inline bool io_sequence_defer(struct io_ring_ctx *ctx, 425 + struct io_kiocb *req) 426 + { 427 + if ((req->flags & (REQ_F_IO_DRAIN|REQ_F_IO_DRAINED)) != REQ_F_IO_DRAIN) 428 + return false; 429 + 430 + return __io_sequence_defer(ctx, req); 431 + } 432 + 433 + static struct io_kiocb *io_get_deferred_req(struct io_ring_ctx *ctx) 431 434 { 432 435 struct io_kiocb *req; 433 436 434 - if (list_empty(list)) 435 - return NULL; 436 - 437 - req = list_first_entry(list, struct io_kiocb, list); 438 - if (!io_sequence_defer(ctx, req)) { 437 + req = list_first_entry_or_null(&ctx->defer_list, struct io_kiocb, list); 438 + if (req && !io_sequence_defer(ctx, req)) { 439 439 list_del_init(&req->list); 440 440 return req; 441 441 } ··· 443 443 return NULL; 444 444 } 445 445 446 - static struct io_kiocb *io_get_deferred_req(struct io_ring_ctx *ctx) 447 - { 448 - return __io_get_deferred_req(ctx, &ctx->defer_list); 449 - } 450 - 451 446 static struct io_kiocb *io_get_timeout_req(struct io_ring_ctx *ctx) 452 447 { 453 - return __io_get_deferred_req(ctx, &ctx->timeout_list); 448 + struct io_kiocb *req; 449 + 450 + req = list_first_entry_or_null(&ctx->timeout_list, struct io_kiocb, list); 451 + if (req && !__io_sequence_defer(ctx, req)) { 452 + list_del_init(&req->list); 453 + return req; 454 + } 455 + 456 + return NULL; 454 457 } 455 458 456 459 static void __io_commit_cqring(struct io_ring_ctx *ctx)