FAILED: patch "[PATCH] nvme: unregister when pr_register() is given a zero new key" failed to apply to 5.15-stable tree
Subsystems (2)
Sasha Levin
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x a9d431124fb2e58215daf0299d6fcf47bbc2d6b1
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.15.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From a9d431124fb2e58215daf0299d6fcf47bbc2d6b1 Mon Sep 17 00:00:00 2001
From: Daejun Park <[email protected]>
Date: Thu, 29 Oct 2026 09:51:24 +0900
Subject: [PATCH] nvme: unregister when pr_register() is given a zero new key
The block layer PR API defines a zero new_key in pr_register() as unregistering old_key. nvme_pr_register() sends Replace Reservation Key with a zero NRKEY instead. The host stays registered with key 0, and its next registration with another key fails with Reservation Conflict.
The pNFS SCSI layout client unregisters this way at umount. A later mount cannot register and sends all I/O through the metadata server.
Send Unregister Reservation Key when new_key is zero.
--- drivers/nvme/host/pr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/nvme/host/pr.c +6 -2
@@ -128,8 +128,12 @@ static int nvme_pr_register(struct block_device *bdev, u64 old_key, u64 new_key, data.crkey =cpu_to_le64 (old_key); data.nrkey =cpu_to_le64 (new_key); - cdw10 = old_key ?NVME_PR_REGISTER_ACT_REPLACE : -NVME_PR_REGISTER_ACT_REG ; +if (!new_key) + cdw10 =NVME_PR_REGISTER_ACT_UNREG ; +else if (old_key) + cdw10 =NVME_PR_REGISTER_ACT_REPLACE ; +else + cdw10 =NVME_PR_REGISTER_ACT_REG ; cdw10 |= (flags &PR_FL_IGNORE_KEY ) ?NVME_PR_IGNORE_KEY :0 ; cdw10 |=NVME_PR_CPTPL_PERSIST ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 nvme: unregister when pr_register() is given a zero new key
From: Daejun Park <[email protected]>
[ Upstream commit a9d431124fb2e58215daf0299d6fcf47bbc2d6b1 ]
The block layer PR API defines a zero new_key in pr_register() as unregistering old_key. nvme_pr_register() sends Replace Reservation Key with a zero NRKEY instead. The host stays registered with key 0, and its next registration with another key fails with Reservation Conflict.
The pNFS SCSI layout client unregisters this way at umount. A later mount cannot register and sends all I/O through the metadata server.
Send Unregister Reservation Key when new_key is zero.
--- drivers/nvme/host/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +6 -1
@@ -2089,7 +2089,12 @@ static int nvme_pr_register(struct block_device *bdev, u64 old,if (flags & ~PR_FL_IGNORE_KEY )return -EOPNOTSUPP ; - cdw10 = old ?2 :0 ; +if (!new) + cdw10 =1 ; +else if (old) + cdw10 =2 ; +else + cdw10 =0 ; cdw10 |= (flags &PR_FL_IGNORE_KEY ) ?1 <<3 :0 ; cdw10 |= (1 <<30 ) | (1 <<31 );/* PTPL=1 */ return nvme_pr_command (bdev, cdw10, old, new, nvme_cmd_resv_register);
Signature · 1 line
2.53.0