From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Guixin Liu <kanie@linux.alibaba.com>,
Hannes Reinecke <hare@kernel.org>, Christoph Hellwig <hch@lst.de>,
Nilay Shroff <nilay@linux.ibm.com>,
Keith Busch <kbusch@kernel.org>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.18.y] nvmet: use GFP_KERNEL for PR allocations
Date: Fri, 4 Dec 2026 00:13:10 -0500 [thread overview]
Message-ID: <20261204051250.2736553-1-sashal@kernel.org> (raw)
In-Reply-To: <2026120231-footprint-eligible-a023@gregkh>
From: Guixin Liu <kanie@linux.alibaba.com>
[ Upstream commit 976311c5594a7a26047891f087ad59a804e02baa ]
nvmet_pr_update_reg_attr() and nvmet_pr_alloc_and_insert_pc_ref()
allocate with GFP_ATOMIC, but both run in sleepable context: the PR
command handlers execute from the transport workqueues and take the
pr_sem semaphore, and the pc_ref allocation is reached from the
connect and configfs paths. The latter function even passes
GFP_KERNEL to the percpu_ref_init() in the same scope, so the
GFP_ATOMIC only raises the failure rate for no reason.
Switch both allocations to GFP_KERNEL.
Fixes: 5a47c2080a73 ("nvmet: support reservation feature")
Cc: stable@vger.kernel.org
Reviewed-by: Hannes Reinecke <hare@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
[ sashal: Kept the existing kmalloc(sizeof(*ptr), ...) allocation form instead of kmalloc_obj() in the context lines, while still switching both GFP_ATOMIC flags to GFP_KERNEL. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/pr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/pr.c b/drivers/nvme/target/pr.c
index 7ce7b179467f2..f10040d023128 100644
--- a/drivers/nvme/target/pr.c
+++ b/drivers/nvme/target/pr.c
@@ -341,7 +341,7 @@ static u16 nvmet_pr_update_reg_attr(struct nvmet_pr *pr,
return NVME_SC_SUCCESS;
}
- new = kmalloc(sizeof(*new), GFP_ATOMIC);
+ new = kmalloc(sizeof(*new), GFP_KERNEL);
if (!new)
return NVME_SC_INTERNAL;
@@ -1046,7 +1046,7 @@ static int nvmet_pr_alloc_and_insert_pc_ref(struct nvmet_ns *ns,
struct nvmet_pr_per_ctrl_ref *pc_ref;
int ret;
- pc_ref = kmalloc(sizeof(*pc_ref), GFP_ATOMIC);
+ pc_ref = kmalloc(sizeof(*pc_ref), GFP_KERNEL);
if (!pc_ref)
return -ENOMEM;
--
2.53.0
prev parent reply other threads:[~2026-12-04 5:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 13:52 FAILED: patch "[PATCH] nvmet: use GFP_KERNEL for PR allocations" failed to apply to 6.18-stable tree gregkh
2026-12-04 5:13 ` Sasha Levin [this message]
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=20261204051250.2736553-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=hare@kernel.org \
--cc=hch@lst.de \
--cc=kanie@linux.alibaba.com \
--cc=kbusch@kernel.org \
--cc=nilay@linux.ibm.com \
--cc=stable@vger.kernel.org \
/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.