Skip to content

Commit a5beb58

Browse files
committed
Merge tag 'block-6.18-20251031' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux
Pull block fixes from Jens Axboe: - Fix blk-crypto reporting EIO when EINVAL is the correct error code - Two bug fixes for the block zone support - NVME pull request via Keith: - Target side authentication fixup - Peer-to-peer metadata fixup - null_blk DMA alignment fix * tag 'block-6.18-20251031' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: null_blk: set dma alignment to logical block size blk-crypto: use BLK_STS_INVAL for alignment errors block: make REQ_OP_ZONE_OPEN a write operation block: fix op_is_zone_mgmt() to handle REQ_OP_ZONE_RESET_ALL nvme-pci: use blk_map_iter for p2p metadata nvmet-auth: update sc_c in host response
2 parents b4f7f01 + 0d92a3e commit a5beb58

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

block/blk-crypto.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ bool __blk_crypto_bio_prep(struct bio **bio_ptr)
292292
}
293293

294294
if (!bio_crypt_check_alignment(bio)) {
295-
bio->bi_status = BLK_STS_IOERR;
295+
bio->bi_status = BLK_STS_INVAL;
296296
goto fail;
297297
}
298298

drivers/block/null_blk/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,6 +1949,7 @@ static int null_add_dev(struct nullb_device *dev)
19491949
.logical_block_size = dev->blocksize,
19501950
.physical_block_size = dev->blocksize,
19511951
.max_hw_sectors = dev->max_sectors,
1952+
.dma_alignment = dev->blocksize - 1,
19521953
};
19531954

19541955
struct nullb *nullb;

drivers/nvme/host/pci.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ static blk_status_t nvme_map_data(struct request *req)
10421042
return nvme_pci_setup_data_prp(req, &iter);
10431043
}
10441044

1045-
static blk_status_t nvme_pci_setup_meta_sgls(struct request *req)
1045+
static blk_status_t nvme_pci_setup_meta_iter(struct request *req)
10461046
{
10471047
struct nvme_queue *nvmeq = req->mq_hctx->driver_data;
10481048
unsigned int entries = req->nr_integrity_segments;
@@ -1072,8 +1072,12 @@ static blk_status_t nvme_pci_setup_meta_sgls(struct request *req)
10721072
* descriptor provides an explicit length, so we're relying on that
10731073
* mechanism to catch any misunderstandings between the application and
10741074
* device.
1075+
*
1076+
* P2P DMA also needs to use the blk_dma_iter method, so mptr setup
1077+
* leverages this routine when that happens.
10751078
*/
1076-
if (entries == 1 && !(nvme_req(req)->flags & NVME_REQ_USERCMD)) {
1079+
if (!nvme_ctrl_meta_sgl_supported(&dev->ctrl) ||
1080+
(entries == 1 && !(nvme_req(req)->flags & NVME_REQ_USERCMD))) {
10771081
iod->cmd.common.metadata = cpu_to_le64(iter.addr);
10781082
iod->meta_total_len = iter.len;
10791083
iod->meta_dma = iter.addr;
@@ -1114,6 +1118,9 @@ static blk_status_t nvme_pci_setup_meta_mptr(struct request *req)
11141118
struct nvme_queue *nvmeq = req->mq_hctx->driver_data;
11151119
struct bio_vec bv = rq_integrity_vec(req);
11161120

1121+
if (is_pci_p2pdma_page(bv.bv_page))
1122+
return nvme_pci_setup_meta_iter(req);
1123+
11171124
iod->meta_dma = dma_map_bvec(nvmeq->dev->dev, &bv, rq_dma_dir(req), 0);
11181125
if (dma_mapping_error(nvmeq->dev->dev, iod->meta_dma))
11191126
return BLK_STS_IOERR;
@@ -1128,7 +1135,7 @@ static blk_status_t nvme_map_metadata(struct request *req)
11281135

11291136
if ((iod->cmd.common.flags & NVME_CMD_SGL_METABUF) &&
11301137
nvme_pci_metadata_use_sgls(req))
1131-
return nvme_pci_setup_meta_sgls(req);
1138+
return nvme_pci_setup_meta_iter(req);
11321139
return nvme_pci_setup_meta_mptr(req);
11331140
}
11341141

drivers/nvme/target/auth.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ int nvmet_auth_host_hash(struct nvmet_req *req, u8 *response,
298298
const char *hash_name;
299299
u8 *challenge = req->sq->dhchap_c1;
300300
struct nvme_dhchap_key *transformed_key;
301-
u8 buf[4];
301+
u8 buf[4], sc_c = ctrl->concat ? 1 : 0;
302302
int ret;
303303

304304
hash_name = nvme_auth_hmac_name(ctrl->shash_id);
@@ -367,13 +367,14 @@ int nvmet_auth_host_hash(struct nvmet_req *req, u8 *response,
367367
ret = crypto_shash_update(shash, buf, 2);
368368
if (ret)
369369
goto out;
370-
memset(buf, 0, 4);
370+
*buf = sc_c;
371371
ret = crypto_shash_update(shash, buf, 1);
372372
if (ret)
373373
goto out;
374374
ret = crypto_shash_update(shash, "HostHost", 8);
375375
if (ret)
376376
goto out;
377+
memset(buf, 0, 4);
377378
ret = crypto_shash_update(shash, ctrl->hostnqn, strlen(ctrl->hostnqn));
378379
if (ret)
379380
goto out;

include/linux/blk_types.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,15 @@ enum req_op {
341341
/* write the zero filled sector many times */
342342
REQ_OP_WRITE_ZEROES = (__force blk_opf_t)9,
343343
/* Open a zone */
344-
REQ_OP_ZONE_OPEN = (__force blk_opf_t)10,
344+
REQ_OP_ZONE_OPEN = (__force blk_opf_t)11,
345345
/* Close a zone */
346-
REQ_OP_ZONE_CLOSE = (__force blk_opf_t)11,
346+
REQ_OP_ZONE_CLOSE = (__force blk_opf_t)13,
347347
/* Transition a zone to full */
348-
REQ_OP_ZONE_FINISH = (__force blk_opf_t)13,
348+
REQ_OP_ZONE_FINISH = (__force blk_opf_t)15,
349349
/* reset a zone write pointer */
350-
REQ_OP_ZONE_RESET = (__force blk_opf_t)15,
350+
REQ_OP_ZONE_RESET = (__force blk_opf_t)17,
351351
/* reset all the zone present on the device */
352-
REQ_OP_ZONE_RESET_ALL = (__force blk_opf_t)17,
352+
REQ_OP_ZONE_RESET_ALL = (__force blk_opf_t)19,
353353

354354
/* Driver private requests */
355355
REQ_OP_DRV_IN = (__force blk_opf_t)34,
@@ -478,6 +478,7 @@ static inline bool op_is_zone_mgmt(enum req_op op)
478478
{
479479
switch (op & REQ_OP_MASK) {
480480
case REQ_OP_ZONE_RESET:
481+
case REQ_OP_ZONE_RESET_ALL:
481482
case REQ_OP_ZONE_OPEN:
482483
case REQ_OP_ZONE_CLOSE:
483484
case REQ_OP_ZONE_FINISH:

0 commit comments

Comments
 (0)