All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Maurizio Lombardi" <mlombard@arkamax.eu>
To: "Sang-Hoon Choi" <csh0052@gmail.com>,
	"Christoph Hellwig" <hch@lst.de>,
	"Sagi Grimberg" <sagi@grimberg.me>,
	"Chaitanya Kulkarni" <kch@nvidia.com>
Cc: <linux-nvme@lists.infradead.org>, "Changyul Lee" <lcy8047@gmail.com>
Subject: Re: [PATCH] nvmet: use the local P2P device on metadata allocation failure
Date: Wed, 30 Sep 2026 10:05:03 +0200	[thread overview]
Message-ID: <DLSHUHHXUD8C.2P2HXJTWO2DQT@arkamax.eu> (raw)
In-Reply-To: <179075213853.3.11747926147721077082.idr-bug-90@gmail.com>

On Wed Sep 30, 2026 at 9:08 AM CEST, Sang-Hoon Choi wrote:
> nvmet_req_alloc_p2pmem_sgls() assigns req->p2p_dev only after the data
> and metadata SGL allocations succeed. If the data allocation succeeds
> but the metadata allocation fails, out_free_sg passes req->p2p_dev to
> pci_p2pmem_free_sgl() before that assignment has taken place.
>
> Pass the local p2p_dev argument instead, so cleanup uses the same PCI
> device as the successful data allocation.
>
> Fixes: bcd9a0797d73 ("nvmet: fix freeing unallocated p2pmem")
> Reported-by: Changyul Lee <lcy8047@gmail.com>
> Link: https://github.com/lcy8047/radix-tree-bug-temp/blob/main/bug_list/idr-ida-xarray/missing-idr-lock/IDR-BUG-90-nvmet-p2p-ns-map-lookup.md

This link gives 404 to me but anyway the patch looks ok

Reviewed-by: Maurizio Lombardi <mlombard@redhat.com>


> Assisted-by: Sang-Hoon Choi <csh0052@gmail.com>
> Signed-off-by: Sang-Hoon Choi <csh0052@gmail.com>
> ---
> Compile-tested on x86_64 with allmodconfig and W=1 against mainline
> 6f8319e3e9a44dd537d17f41565a8453c560a581. No P2P hardware or metadata
> allocation failure test was performed.
>
>  drivers/nvme/target/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
> index 43871a8f56ca..9ef29b2b49de 100644
> --- a/drivers/nvme/target/core.c
> +++ b/drivers/nvme/target/core.c
> @@ -1317,7 +1317,7 @@ static int nvmet_req_alloc_p2pmem_sgls(struct pci_dev *p2p_dev,
>  
>  	return 0;
>  out_free_sg:
> -	pci_p2pmem_free_sgl(req->p2p_dev, req->sg);
> +	pci_p2pmem_free_sgl(p2p_dev, req->sg);
>  out_err:
>  	return -ENOMEM;
>  }



  reply	other threads:[~2026-09-30  8:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30  7:08 [PATCH] nvmet: use the local P2P device on metadata allocation failure Sang-Hoon Choi
2026-09-30  8:05 ` Maurizio Lombardi [this message]
2026-10-03  8:57 ` Keith Busch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DLSHUHHXUD8C.2P2HXJTWO2DQT@arkamax.eu \
    --to=mlombard@arkamax.eu \
    --cc=csh0052@gmail.com \
    --cc=hch@lst.de \
    --cc=kch@nvidia.com \
    --cc=lcy8047@gmail.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.