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

Merge tag 'block-6.19-20251211' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux

Pull block fixes from Jens Axboe:

- Always initialize DMA state, fixing a potentially nasty issue on the
block side

- btrfs zoned write fix with cached zone reports

- Fix corruption issues in bcache with chained bio's, and further make
it clear that the chained IO handler is simply a marker, it's not
code meant to be executed

- Kill old code dealing with synchronous IO polling in the block layer,
that has been dead for a long time. Only async polling is supported
these days

- Fix a lockdep issue in tag_set management, moving it to RCU

- Fix an issue with ublks bio_vec iteration

- Don't unconditionally enforce blocking issue of ublk control
commands, allow some of them with non-blocking issue as they
do not block

* tag 'block-6.19-20251211' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux:
blk-mq-dma: always initialize dma state
blk-mq: delete task running check in blk_hctx_poll()
block: fix cached zone reports on devices with native zone append
block: Use RCU in blk_mq_[un]quiesce_tagset() instead of set->tag_list_lock
ublk: don't mutate struct bio_vec in iteration
block: prohibit calls to bio_chain_endio
bcache: fix improper use of bi_end_io
ublk: allow non-blocking ctrl cmds in IO_URING_F_NONBLOCK issue

+41 -31
+5 -1
block/bio.c
··· 321 321 return parent; 322 322 } 323 323 324 + /* 325 + * This function should only be used as a flag and must never be called. 326 + * If execution reaches here, it indicates a serious programming error. 327 + */ 324 328 static void bio_chain_endio(struct bio *bio) 325 329 { 326 - bio_endio(__bio_chain_endio(bio)); 330 + BUG(); 327 331 } 328 332 329 333 /**
+1
block/blk-mq-dma.c
··· 199 199 if (blk_can_dma_map_iova(req, dma_dev) && 200 200 dma_iova_try_alloc(dma_dev, state, vec.paddr, total_len)) 201 201 return blk_rq_dma_map_iova(req, dma_dev, state, iter, &vec); 202 + memset(state, 0, sizeof(*state)); 202 203 return blk_dma_map_direct(req, dma_dev, iter, &vec); 203 204 } 204 205
+10 -19
block/blk-mq.c
··· 336 336 { 337 337 struct request_queue *q; 338 338 339 - mutex_lock(&set->tag_list_lock); 340 - list_for_each_entry(q, &set->tag_list, tag_set_list) { 339 + rcu_read_lock(); 340 + list_for_each_entry_rcu(q, &set->tag_list, tag_set_list) { 341 341 if (!blk_queue_skip_tagset_quiesce(q)) 342 342 blk_mq_quiesce_queue_nowait(q); 343 343 } 344 - mutex_unlock(&set->tag_list_lock); 344 + rcu_read_unlock(); 345 345 346 346 blk_mq_wait_quiesce_done(set); 347 347 } ··· 351 351 { 352 352 struct request_queue *q; 353 353 354 - mutex_lock(&set->tag_list_lock); 355 - list_for_each_entry(q, &set->tag_list, tag_set_list) { 354 + rcu_read_lock(); 355 + list_for_each_entry_rcu(q, &set->tag_list, tag_set_list) { 356 356 if (!blk_queue_skip_tagset_quiesce(q)) 357 357 blk_mq_unquiesce_queue(q); 358 358 } 359 - mutex_unlock(&set->tag_list_lock); 359 + rcu_read_unlock(); 360 360 } 361 361 EXPORT_SYMBOL_GPL(blk_mq_unquiesce_tagset); 362 362 ··· 4311 4311 struct blk_mq_tag_set *set = q->tag_set; 4312 4312 4313 4313 mutex_lock(&set->tag_list_lock); 4314 - list_del(&q->tag_set_list); 4314 + list_del_rcu(&q->tag_set_list); 4315 4315 if (list_is_singular(&set->tag_list)) { 4316 4316 /* just transitioned to unshared */ 4317 4317 set->flags &= ~BLK_MQ_F_TAG_QUEUE_SHARED; ··· 4319 4319 blk_mq_update_tag_set_shared(set, false); 4320 4320 } 4321 4321 mutex_unlock(&set->tag_list_lock); 4322 - INIT_LIST_HEAD(&q->tag_set_list); 4323 4322 } 4324 4323 4325 4324 static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set, ··· 4337 4338 } 4338 4339 if (set->flags & BLK_MQ_F_TAG_QUEUE_SHARED) 4339 4340 queue_set_hctx_shared(q, true); 4340 - list_add_tail(&q->tag_set_list, &set->tag_list); 4341 + list_add_tail_rcu(&q->tag_set_list, &set->tag_list); 4341 4342 4342 4343 mutex_unlock(&set->tag_list_lock); 4343 4344 } ··· 5192 5193 static int blk_hctx_poll(struct request_queue *q, struct blk_mq_hw_ctx *hctx, 5193 5194 struct io_comp_batch *iob, unsigned int flags) 5194 5195 { 5195 - long state = get_current_state(); 5196 5196 int ret; 5197 5197 5198 5198 do { 5199 5199 ret = q->mq_ops->poll(hctx, iob); 5200 - if (ret > 0) { 5201 - __set_current_state(TASK_RUNNING); 5200 + if (ret > 0) 5202 5201 return ret; 5203 - } 5204 - 5205 - if (signal_pending_state(state, current)) 5206 - __set_current_state(TASK_RUNNING); 5207 - if (task_is_running(current)) 5202 + if (task_sigpending(current)) 5208 5203 return 1; 5209 - 5210 5204 if (ret < 0 || (flags & BLK_POLL_ONESHOT)) 5211 5205 break; 5212 5206 cpu_relax(); 5213 5207 } while (!need_resched()); 5214 5208 5215 - __set_current_state(TASK_RUNNING); 5216 5209 return 0; 5217 5210 } 5218 5211
+1 -1
block/blk-zoned.c
··· 2100 2100 * we have a zone write plug for such zone if the device has a zone 2101 2101 * write plug hash table. 2102 2102 */ 2103 - if (!queue_emulates_zone_append(disk->queue) || !disk->zone_wplugs_hash) 2103 + if (!disk->zone_wplugs_hash) 2104 2104 return 0; 2105 2105 2106 2106 wp_offset = disk_zone_wplug_sync_wp_offset(disk, zone);
+21 -7
drivers/block/ublk_drv.c
··· 926 926 size_t done = 0; 927 927 928 928 rq_for_each_segment(bv, req, iter) { 929 + unsigned len; 929 930 void *bv_buf; 930 931 size_t copied; 931 932 ··· 935 934 continue; 936 935 } 937 936 938 - bv.bv_offset += offset; 939 - bv.bv_len -= offset; 940 - bv_buf = bvec_kmap_local(&bv); 937 + len = bv.bv_len - offset; 938 + bv_buf = kmap_local_page(bv.bv_page) + bv.bv_offset + offset; 941 939 if (dir == ITER_DEST) 942 - copied = copy_to_iter(bv_buf, bv.bv_len, uiter); 940 + copied = copy_to_iter(bv_buf, len, uiter); 943 941 else 944 - copied = copy_from_iter(bv_buf, bv.bv_len, uiter); 942 + copied = copy_from_iter(bv_buf, len, uiter); 945 943 946 944 kunmap_local(bv_buf); 947 945 948 946 done += copied; 949 - if (copied < bv.bv_len) 947 + if (copied < len) 950 948 break; 951 949 952 950 offset = 0; ··· 3673 3673 return ret; 3674 3674 } 3675 3675 3676 + static bool ublk_ctrl_uring_cmd_may_sleep(u32 cmd_op) 3677 + { 3678 + switch (_IOC_NR(cmd_op)) { 3679 + case UBLK_CMD_GET_QUEUE_AFFINITY: 3680 + case UBLK_CMD_GET_DEV_INFO: 3681 + case UBLK_CMD_GET_DEV_INFO2: 3682 + case _IOC_NR(UBLK_U_CMD_GET_FEATURES): 3683 + return false; 3684 + default: 3685 + return true; 3686 + } 3687 + } 3688 + 3676 3689 static int ublk_ctrl_uring_cmd(struct io_uring_cmd *cmd, 3677 3690 unsigned int issue_flags) 3678 3691 { ··· 3694 3681 u32 cmd_op = cmd->cmd_op; 3695 3682 int ret = -EINVAL; 3696 3683 3697 - if (issue_flags & IO_URING_F_NONBLOCK) 3684 + if (ublk_ctrl_uring_cmd_may_sleep(cmd_op) && 3685 + issue_flags & IO_URING_F_NONBLOCK) 3698 3686 return -EAGAIN; 3699 3687 3700 3688 ublk_ctrl_cmd_dump(cmd);
+3 -3
drivers/md/bcache/request.c
··· 1104 1104 } 1105 1105 1106 1106 kfree(ddip); 1107 - bio->bi_end_io(bio); 1107 + bio_endio(bio); 1108 1108 } 1109 1109 1110 1110 static void detached_dev_do_request(struct bcache_device *d, struct bio *bio, ··· 1121 1121 ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO); 1122 1122 if (!ddip) { 1123 1123 bio->bi_status = BLK_STS_RESOURCE; 1124 - bio->bi_end_io(bio); 1124 + bio_endio(bio); 1125 1125 return; 1126 1126 } 1127 1127 ··· 1136 1136 1137 1137 if ((bio_op(bio) == REQ_OP_DISCARD) && 1138 1138 !bdev_max_discard_sectors(dc->bdev)) 1139 - bio->bi_end_io(bio); 1139 + detached_dev_end_io(bio); 1140 1140 else 1141 1141 submit_bio_noacct(bio); 1142 1142 }