nvme fixes for Linux 6.1

- make the multipath dma alignment to match the non-multipath one
    (Keith Busch)
  - fix a bogus use of sg_init_marker() (Nam Cao)
  - fix circulr locking in nvme-tcp (Sagi Grimberg)
 -----BEGIN PGP SIGNATURE-----
 
 iQI/BAABCgApFiEEgdbnc3r/njty3Iq9D55TZVIEUYMFAmNaiz0LHGhjaEBsc3Qu
 ZGUACgkQD55TZVIEUYM44RAAzMpf5CrAIYEN14kDyvPMyloZkesPgy1s0NpRdI08
 9YBHiLApEIqWXYLLrrSWrYEvE5fOI7YHzIfyzjrYg4Qa94FpI1Jq9AkvekVQ08+P
 kGfT/HK3rMGygIRC4lr6MNLSYypyj3Bq2psI6rUD8Ma/9f3db3SxPinSf86SEXhW
 7WIAiaCZLWFxFZl7tnFE0RPdfNZXTjKxZ4WYntfyrPJt4VTcde/pBRLDq6UPgPC2
 TC6mYcgG9YyLLF6IxPOYy6uBYtgth7Gfo9SWm+YdgQ89sRjm0za5fiqnwx4LoCM2
 EisXlZsbiiWA32chS9F2qKezBAc9dm14Zp1vg73/JDFUfP4B6jOEybgx8rDdjwy4
 2YtLRuXFa7QGJ12qp6ihgpiaqHwY9VbxnyBd4wGgH5xY66dwLuj7uqUdrcNfEtGB
 A+F4OwELxKL7Awk5md5kFX1UPLpH0uoZ+NvtxUzbT3icfLFhgmucmfD8f50G/IM8
 er1Owr4zNNVC4mRGhazw+NGC1c2VpsyFJPvTqBMeIeE5Uwmn/x72D1cHAdBd1kvX
 n0NTgvJ2U/7z/+oCsMcn4ZDvmrdq9+jjXZ/u0JZJs2yNzFx5JpL1l2jMnDXfpzju
 6NjYQQ2+7jlPJ/OURKPvX6BHi4A+vDZhC9NIl//2ksMw4RgpiRFBah9FA8lbOf5v
 boI=
 =Bb9K
 -----END PGP SIGNATURE-----

Merge tag 'nvme-6.1-2022-10-27' of git://git.infradead.org/nvme into block-6.1

Pull NVMe fixes from Christoph:

"nvme fixes for Linux 6.1

 - make the multipath dma alignment to match the non-multipath one
   (Keith Busch)
 - fix a bogus use of sg_init_marker() (Nam Cao)
 - fix circulr locking in nvme-tcp (Sagi Grimberg)"

* tag 'nvme-6.1-2022-10-27' of git://git.infradead.org/nvme:
  nvme-multipath: set queue dma alignment to 3
  nvme-tcp: fix possible circular locking when deleting a controller under memory pressure
  nvme-tcp: replace sg_init_marker() with sg_init_table()
This commit is contained in:
Jens Axboe 2022-10-27 07:49:21 -06:00
commit dea31328d4
2 changed files with 12 additions and 2 deletions

View File

@ -516,6 +516,7 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head)
/* set to a default value of 512 until the disk is validated */
blk_queue_logical_block_size(head->disk->queue, 512);
blk_set_stacking_limits(&head->disk->queue->limits);
blk_queue_dma_alignment(head->disk->queue, 3);
/* we need to propagate up the VMC settings */
if (ctrl->vwc & NVME_CTRL_VWC_PRESENT)

View File

@ -387,7 +387,7 @@ static inline void nvme_tcp_ddgst_update(struct ahash_request *hash,
{
struct scatterlist sg;
sg_init_marker(&sg, 1);
sg_init_table(&sg, 1);
sg_set_page(&sg, page, len, off);
ahash_request_set_crypt(hash, &sg, NULL, len);
crypto_ahash_update(hash);
@ -1141,6 +1141,7 @@ static int nvme_tcp_try_send_ddgst(struct nvme_tcp_request *req)
static int nvme_tcp_try_send(struct nvme_tcp_queue *queue)
{
struct nvme_tcp_request *req;
unsigned int noreclaim_flag;
int ret = 1;
if (!queue->request) {
@ -1150,12 +1151,13 @@ static int nvme_tcp_try_send(struct nvme_tcp_queue *queue)
}
req = queue->request;
noreclaim_flag = memalloc_noreclaim_save();
if (req->state == NVME_TCP_SEND_CMD_PDU) {
ret = nvme_tcp_try_send_cmd_pdu(req);
if (ret <= 0)
goto done;
if (!nvme_tcp_has_inline_data(req))
return ret;
goto out;
}
if (req->state == NVME_TCP_SEND_H2C_PDU) {
@ -1181,6 +1183,8 @@ done:
nvme_tcp_fail_request(queue->request);
nvme_tcp_done_send_req(queue);
}
out:
memalloc_noreclaim_restore(noreclaim_flag);
return ret;
}
@ -1296,6 +1300,7 @@ static void nvme_tcp_free_queue(struct nvme_ctrl *nctrl, int qid)
struct page *page;
struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl);
struct nvme_tcp_queue *queue = &ctrl->queues[qid];
unsigned int noreclaim_flag;
if (!test_and_clear_bit(NVME_TCP_Q_ALLOCATED, &queue->flags))
return;
@ -1308,7 +1313,11 @@ static void nvme_tcp_free_queue(struct nvme_ctrl *nctrl, int qid)
__page_frag_cache_drain(page, queue->pf_cache.pagecnt_bias);
queue->pf_cache.va = NULL;
}
noreclaim_flag = memalloc_noreclaim_save();
sock_release(queue->sock);
memalloc_noreclaim_restore(noreclaim_flag);
kfree(queue->pdu);
mutex_destroy(&queue->send_mutex);
mutex_destroy(&queue->queue_lock);