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-20191115' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:
"A few fixes that should make it into this release. This contains:

- io_uring:
- The timeout command assumes sequence == 0 means that we want
one completion, but this kind of overloading is unfortunate as
it prevents users from doing a pure time based wait. Since
this operation was introduced in this cycle, let's correct it
now, while we can. (me)
- One-liner to fix an issue with dependent links and fixed
buffer reads. The actual IO completed fine, but the link got
severed since we stored the wrong expected value. (me)
- Add TIMEOUT to list of opcodes that don't need a file. (Pavel)

- rsxx missing workqueue destry calls. Old bug. (Chuhong)

- Fix blk-iocost active list check (Jiufei)

- Fix impossible-to-hit overflow merge condition, that still hit some
folks very rarely (Junichi)

- Fix bfq hang issue from 5.3. This didn't get marked for stable, but
will go into stable post this merge (Paolo)"

* tag 'for-linus-20191115' of git://git.kernel.dk/linux-block:
rsxx: add missed destroy_workqueue calls in remove
iocost: check active_list of all the ancestors in iocg_activate()
block, bfq: deschedule empty bfq_queues not referred by any process
io_uring: ensure registered buffer import returns the IO length
io_uring: Fix getting file for timeout
block: check bi_size overflow before merge
io_uring: make timeout sequence == 0 mean no sequence

+59 -17
+26 -6
block/bfq-iosched.c
··· 2713 2713 } 2714 2714 } 2715 2715 2716 + 2717 + static 2718 + void bfq_release_process_ref(struct bfq_data *bfqd, struct bfq_queue *bfqq) 2719 + { 2720 + /* 2721 + * To prevent bfqq's service guarantees from being violated, 2722 + * bfqq may be left busy, i.e., queued for service, even if 2723 + * empty (see comments in __bfq_bfqq_expire() for 2724 + * details). But, if no process will send requests to bfqq any 2725 + * longer, then there is no point in keeping bfqq queued for 2726 + * service. In addition, keeping bfqq queued for service, but 2727 + * with no process ref any longer, may have caused bfqq to be 2728 + * freed when dequeued from service. But this is assumed to 2729 + * never happen. 2730 + */ 2731 + if (bfq_bfqq_busy(bfqq) && RB_EMPTY_ROOT(&bfqq->sort_list) && 2732 + bfqq != bfqd->in_service_queue) 2733 + bfq_del_bfqq_busy(bfqd, bfqq, false); 2734 + 2735 + bfq_put_queue(bfqq); 2736 + } 2737 + 2716 2738 static void 2717 2739 bfq_merge_bfqqs(struct bfq_data *bfqd, struct bfq_io_cq *bic, 2718 2740 struct bfq_queue *bfqq, struct bfq_queue *new_bfqq) ··· 2805 2783 */ 2806 2784 new_bfqq->pid = -1; 2807 2785 bfqq->bic = NULL; 2808 - /* release process reference to bfqq */ 2809 - bfq_put_queue(bfqq); 2786 + bfq_release_process_ref(bfqd, bfqq); 2810 2787 } 2811 2788 2812 2789 static bool bfq_allow_bio_merge(struct request_queue *q, struct request *rq, ··· 4920 4899 4921 4900 bfq_put_cooperator(bfqq); 4922 4901 4923 - bfq_put_queue(bfqq); /* release process reference */ 4902 + bfq_release_process_ref(bfqd, bfqq); 4924 4903 } 4925 4904 4926 4905 static void bfq_exit_icq_bfqq(struct bfq_io_cq *bic, bool is_sync) ··· 5022 5001 5023 5002 bfqq = bic_to_bfqq(bic, false); 5024 5003 if (bfqq) { 5025 - /* release process reference on this queue */ 5026 - bfq_put_queue(bfqq); 5004 + bfq_release_process_ref(bfqd, bfqq); 5027 5005 bfqq = bfq_get_queue(bfqd, bio, BLK_RW_ASYNC, bic); 5028 5006 bic_set_bfqq(bic, bfqq, false); 5029 5007 } ··· 5983 5963 5984 5964 bfq_put_cooperator(bfqq); 5985 5965 5986 - bfq_put_queue(bfqq); 5966 + bfq_release_process_ref(bfqq->bfqd, bfqq); 5987 5967 return NULL; 5988 5968 } 5989 5969
+1 -1
block/bio.c
··· 751 751 if (WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED))) 752 752 return false; 753 753 754 - if (bio->bi_vcnt > 0) { 754 + if (bio->bi_vcnt > 0 && !bio_full(bio, len)) { 755 755 struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1]; 756 756 757 757 if (page_is_mergeable(bv, page, len, off, same_page)) {
+6 -2
block/blk-iocost.c
··· 1057 1057 atomic64_set(&iocg->active_period, cur_period); 1058 1058 1059 1059 /* already activated or breaking leaf-only constraint? */ 1060 - for (i = iocg->level; i > 0; i--) 1061 - if (!list_empty(&iocg->active_list)) 1060 + if (!list_empty(&iocg->active_list)) 1061 + goto succeed_unlock; 1062 + for (i = iocg->level - 1; i > 0; i--) 1063 + if (!list_empty(&iocg->ancestors[i]->active_list)) 1062 1064 goto fail_unlock; 1065 + 1063 1066 if (iocg->child_active_sum) 1064 1067 goto fail_unlock; 1065 1068 ··· 1104 1101 ioc_start_period(ioc, now); 1105 1102 } 1106 1103 1104 + succeed_unlock: 1107 1105 spin_unlock_irq(&ioc->lock); 1108 1106 return true; 1109 1107
+2
drivers/block/rsxx/core.c
··· 1000 1000 1001 1001 cancel_work_sync(&card->event_work); 1002 1002 1003 + destroy_workqueue(card->event_wq); 1003 1004 rsxx_destroy_dev(card); 1004 1005 rsxx_dma_destroy(card); 1006 + destroy_workqueue(card->creg_ctrl.creg_wq); 1005 1007 1006 1008 spin_lock_irqsave(&card->irq_lock, flags); 1007 1009 rsxx_disable_ier_and_isr(card, CR_INTR_ALL);
+24 -8
fs/io_uring.c
··· 326 326 #define REQ_F_TIMEOUT 1024 /* timeout request */ 327 327 #define REQ_F_ISREG 2048 /* regular file */ 328 328 #define REQ_F_MUST_PUNT 4096 /* must be punted even for NONBLOCK */ 329 + #define REQ_F_TIMEOUT_NOSEQ 8192 /* no timeout sequence */ 329 330 u64 user_data; 330 331 u32 result; 331 332 u32 sequence; ··· 454 453 struct io_kiocb *req; 455 454 456 455 req = list_first_entry_or_null(&ctx->timeout_list, struct io_kiocb, list); 457 - if (req && !__io_sequence_defer(ctx, req)) { 458 - list_del_init(&req->list); 459 - return req; 456 + if (req) { 457 + if (req->flags & REQ_F_TIMEOUT_NOSEQ) 458 + return NULL; 459 + if (!__io_sequence_defer(ctx, req)) { 460 + list_del_init(&req->list); 461 + return req; 462 + } 460 463 } 461 464 462 465 return NULL; ··· 1230 1225 } 1231 1226 } 1232 1227 1233 - return 0; 1228 + return len; 1234 1229 } 1235 1230 1236 1231 static ssize_t io_import_iovec(struct io_ring_ctx *ctx, int rw, ··· 1946 1941 if (get_timespec64(&ts, u64_to_user_ptr(sqe->addr))) 1947 1942 return -EFAULT; 1948 1943 1944 + req->flags |= REQ_F_TIMEOUT; 1945 + 1949 1946 /* 1950 1947 * sqe->off holds how many events that need to occur for this 1951 - * timeout event to be satisfied. 1948 + * timeout event to be satisfied. If it isn't set, then this is 1949 + * a pure timeout request, sequence isn't used. 1952 1950 */ 1953 1951 count = READ_ONCE(sqe->off); 1954 - if (!count) 1955 - count = 1; 1952 + if (!count) { 1953 + req->flags |= REQ_F_TIMEOUT_NOSEQ; 1954 + spin_lock_irq(&ctx->completion_lock); 1955 + entry = ctx->timeout_list.prev; 1956 + goto add; 1957 + } 1956 1958 1957 1959 req->sequence = ctx->cached_sq_head + count - 1; 1958 1960 /* reuse it to store the count */ 1959 1961 req->submit.sequence = count; 1960 - req->flags |= REQ_F_TIMEOUT; 1961 1962 1962 1963 /* 1963 1964 * Insertion sort, ensuring the first entry in the list is always ··· 1974 1963 struct io_kiocb *nxt = list_entry(entry, struct io_kiocb, list); 1975 1964 unsigned nxt_sq_head; 1976 1965 long long tmp, tmp_nxt; 1966 + 1967 + if (nxt->flags & REQ_F_TIMEOUT_NOSEQ) 1968 + continue; 1977 1969 1978 1970 /* 1979 1971 * Since cached_sq_head + count - 1 can overflow, use type long ··· 2004 1990 nxt->sequence++; 2005 1991 } 2006 1992 req->sequence -= span; 1993 + add: 2007 1994 list_add(&req->list, entry); 2008 1995 spin_unlock_irq(&ctx->completion_lock); 2009 1996 ··· 2298 2283 switch (op) { 2299 2284 case IORING_OP_NOP: 2300 2285 case IORING_OP_POLL_REMOVE: 2286 + case IORING_OP_TIMEOUT: 2301 2287 return false; 2302 2288 default: 2303 2289 return true;