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 'block-6.3-2023-04-06' of git://git.kernel.dk/linux

Pull block fixes from Jens Axboe:

- Ensure that ublk always reads the whole sqe upfront (me)

- Fix for a block size probing issue with ublk (Ming)

- Fix for the bio based polling (Keith)

- NVMe pull request via Christoph:
- fix discard support without oncs (Keith Busch)

- Partition scan error handling regression fix (Yu)

* tag 'block-6.3-2023-04-06' of git://git.kernel.dk/linux:
block: don't set GD_NEED_PART_SCAN if scan partition failed
block: ublk: make sure that block size is set correctly
ublk: read any SQE values upfront
nvme: fix discard support without oncs
blk-mq: directly poll requests

+34 -10
+1 -3
block/blk-mq.c
··· 1359 1359 return false; 1360 1360 if (rq->mq_hctx->type != HCTX_TYPE_POLL) 1361 1361 return false; 1362 - if (WARN_ON_ONCE(!rq->bio)) 1363 - return false; 1364 1362 return true; 1365 1363 } 1366 1364 EXPORT_SYMBOL_GPL(blk_rq_is_poll); ··· 1366 1368 static void blk_rq_poll_completion(struct request *rq, struct completion *wait) 1367 1369 { 1368 1370 do { 1369 - bio_poll(rq->bio, NULL, 0); 1371 + blk_mq_poll(rq->q, blk_rq_to_qc(rq), NULL, 0); 1370 1372 cond_resched(); 1371 1373 } while (!completion_done(wait)); 1372 1374 }
+7 -1
block/genhd.c
··· 368 368 if (disk->open_partitions) 369 369 return -EBUSY; 370 370 371 - set_bit(GD_NEED_PART_SCAN, &disk->state); 372 371 /* 373 372 * If the device is opened exclusively by current thread already, it's 374 373 * safe to scan partitons, otherwise, use bd_prepare_to_claim() to ··· 380 381 return ret; 381 382 } 382 383 384 + set_bit(GD_NEED_PART_SCAN, &disk->state); 383 385 bdev = blkdev_get_by_dev(disk_devt(disk), mode & ~FMODE_EXCL, NULL); 384 386 if (IS_ERR(bdev)) 385 387 ret = PTR_ERR(bdev); 386 388 else 387 389 blkdev_put(bdev, mode & ~FMODE_EXCL); 388 390 391 + /* 392 + * If blkdev_get_by_dev() failed early, GD_NEED_PART_SCAN is still set, 393 + * and this will cause that re-assemble partitioned raid device will 394 + * creat partition for underlying disk. 395 + */ 396 + clear_bit(GD_NEED_PART_SCAN, &disk->state); 389 397 if (!(mode & FMODE_EXCL)) 390 398 bd_abort_claiming(disk->part0, disk_scan_partitions); 391 399 return ret;
+23 -3
drivers/block/ublk_drv.c
··· 246 246 if (ub->params.types & UBLK_PARAM_TYPE_BASIC) { 247 247 const struct ublk_param_basic *p = &ub->params.basic; 248 248 249 - if (p->logical_bs_shift > PAGE_SHIFT) 249 + if (p->logical_bs_shift > PAGE_SHIFT || p->logical_bs_shift < 9) 250 250 return -EINVAL; 251 251 252 252 if (p->logical_bs_shift > p->physical_bs_shift) ··· 1261 1261 ublk_queue_cmd(ubq, req); 1262 1262 } 1263 1263 1264 - static int ublk_ch_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) 1264 + static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd, 1265 + unsigned int issue_flags, 1266 + struct ublksrv_io_cmd *ub_cmd) 1265 1267 { 1266 - struct ublksrv_io_cmd *ub_cmd = (struct ublksrv_io_cmd *)cmd->cmd; 1267 1268 struct ublk_device *ub = cmd->file->private_data; 1268 1269 struct ublk_queue *ubq; 1269 1270 struct ublk_io *io; ··· 1361 1360 pr_devel("%s: complete: cmd op %d, tag %d ret %x io_flags %x\n", 1362 1361 __func__, cmd_op, tag, ret, io->flags); 1363 1362 return -EIOCBQUEUED; 1363 + } 1364 + 1365 + static int ublk_ch_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) 1366 + { 1367 + struct ublksrv_io_cmd *ub_src = (struct ublksrv_io_cmd *) cmd->cmd; 1368 + struct ublksrv_io_cmd ub_cmd; 1369 + 1370 + /* 1371 + * Not necessary for async retry, but let's keep it simple and always 1372 + * copy the values to avoid any potential reuse. 1373 + */ 1374 + ub_cmd.q_id = READ_ONCE(ub_src->q_id); 1375 + ub_cmd.tag = READ_ONCE(ub_src->tag); 1376 + ub_cmd.result = READ_ONCE(ub_src->result); 1377 + ub_cmd.addr = READ_ONCE(ub_src->addr); 1378 + 1379 + return __ublk_ch_uring_cmd(cmd, issue_flags, &ub_cmd); 1364 1380 } 1365 1381 1366 1382 static const struct file_operations ublk_ch_fops = { ··· 1970 1952 /* clear all we don't support yet */ 1971 1953 ub->params.types &= UBLK_PARAM_TYPE_ALL; 1972 1954 ret = ublk_validate_params(ub); 1955 + if (ret) 1956 + ub->params.types = 0; 1973 1957 } 1974 1958 mutex_unlock(&ub->mutex); 1975 1959
+3 -3
drivers/nvme/host/core.c
··· 1674 1674 struct request_queue *queue = disk->queue; 1675 1675 u32 size = queue_logical_block_size(queue); 1676 1676 1677 + if (ctrl->dmrsl && ctrl->dmrsl <= nvme_sect_to_lba(ns, UINT_MAX)) 1678 + ctrl->max_discard_sectors = nvme_lba_to_sect(ns, ctrl->dmrsl); 1679 + 1677 1680 if (ctrl->max_discard_sectors == 0) { 1678 1681 blk_queue_max_discard_sectors(queue, 0); 1679 1682 return; ··· 1690 1687 /* If discard is already enabled, don't reset queue limits */ 1691 1688 if (queue->limits.max_discard_sectors) 1692 1689 return; 1693 - 1694 - if (ctrl->dmrsl && ctrl->dmrsl <= nvme_sect_to_lba(ns, UINT_MAX)) 1695 - ctrl->max_discard_sectors = nvme_lba_to_sect(ns, ctrl->dmrsl); 1696 1690 1697 1691 blk_queue_max_discard_sectors(queue, ctrl->max_discard_sectors); 1698 1692 blk_queue_max_discard_segments(queue, ctrl->max_discard_segments);