From: Dai Ngo <dai.ngo@oracle.com>
To: Benjamin Coddington <bcodding@redhat.com>
Cc: chuck.lever@oracle.com, jlayton@kernel.org, neilb@suse.de,
okorniev@redhat.com, tom@talpey.com, hch@infradead.org,
linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/1] NFSD: Fix SCSI reservation conflict causing pNFS client to revert I/O to MDS
Date: Thu, 9 Oct 2025 13:20:30 -0700 [thread overview]
Message-ID: <2ae4be6e-50ce-496f-8b5d-63b131745848@oracle.com> (raw)
In-Reply-To: <C3EE031E-F587-41B1-8ECA-A29B56AA6764@redhat.com>
On 10/9/25 12:46 PM, Benjamin Coddington wrote:
> On 9 Oct 2025, at 13:43, Dai Ngo wrote:
>
>> On 10/7/25 1:37 PM, Benjamin Coddington wrote:
>>> On 7 Oct 2025, at 11:59, Dai Ngo wrote:
>>>
>>>> On 10/1/25 10:36 AM, Dai Ngo wrote:
>>>>> On 10/1/25 3:54 AM, Benjamin Coddington wrote:
>>>>>> On 30 Sep 2025, at 17:41, Dai Ngo wrote:
>>>>>>
>>>>>>> Hi Ben,
>>>>>>>
>>>>>>> On 9/30/25 12:15 PM, Benjamin Coddington wrote:
>>>>>>>> Hi Dai,
>>>>>>>>
>>>>>>>> On 30 Sep 2025, at 12:28, Dai Ngo wrote:
>>>>>>>>
>>>>>>>>> When servicing the GETDEVICEINFO call from an NFS client, the NFS server
>>>>>>>>> creates a SCSI persistent reservation on the target device using the
>>>>>>>>> reservation type PR_EXCLUSIVE_ACCESS_REG_ONLY. This setting restricts
>>>>>>>>> device access so that only hosts registered with a reservation key can
>>>>>>>>> perform read or write operations. Any unregistered initiator is completely
>>>>>>>>> blocked, including standard SCSI commands such as READCAPACITY.
>>>>>>>> SBC-4, table 13 shows that READ CAPACITY should be allowed from any I_T
>>>>>>>> nexus, no matter the state of the reservation on the LU.
>>>>>>>>
>>>>>>>> Is it possible that your SCSI implementation might be out of the spec? Also
>>>>>>>> possible that SBC-4 has been updated, I haven't been following the SCSI
>>>>>>>> specification updates..
>>>>>>>>
>>>>>>>> Ben
>>>>>>> I don't have access to SBC-4 spec, t10.org does not allow guest access
>>>>>>> to their docs. Can you please share the content of table 13 here?
>>>>>> The document's licensing prohibits me from doing this, I'm sorry to report.
>>>>>> I have a single-user copy that prohibits me from copying or transmitting any
>>>>>> part or whole. Looks like you can get SBC-5 from the ANSI webstore for $60:
>>>>>>
>>>>>> https://urldefense.com/v3/__https://webstore.ansi.org/standards/incits/incits5712025__;!!ACWV5N9M2RV99hQ!N4FtetrpMVBPf88WPTlz6EuwsK0kPhNqw04MXvtXGUwMzzAf0NPkCYhL5HYx32ZZVogW2MKS0Jr8P8M$
>>>>>>
>>>>>> The reason your patch caught my eye was because we'd previously fixed the
>>>>>> same problem in the SCSI LIO target.
>>>>> Thank you Ben, I'll get the spec from the ANSI webstore.
>>>> You're right Ben! The SBC-4 spec says read capacity is allowed in this
>>>> case.
>>>>
>>>> The problem was caused by the DS was running an older version of the
>>>> kernel that did not have your fix:
>>>>
>>>> 28c58f8a0947f scsi: target: Enable READ CAPACITY for PR EARO
>>>>
>>>> This fix did not include the SERVICE_ACTION_IN_16 with Service Action
>>>> READ_CAPACITY. However, the Linux client tries SERVICE_ACTION_IN_16
>>>> three times then switches to READ CAPACITY (0x25).
>>>>
>>>> Thank you for pointing this out.
>>> Would you be willing to test this patch for SERVICE_ACTION_IN_16?
>>>
>>> From d7fa5d5f593dcfe39b7456dd6f23eb042fb2636f Mon Sep 17 00:00:00 2001
>>> Message-ID: <d7fa5d5f593dcfe39b7456dd6f23eb042fb2636f.1759869410.git.bcodding@redhat.com>
>>> From: Benjamin Coddington <bcodding@redhat.com>
>>> Date: Tue, 7 Oct 2025 16:34:37 -0400
>>> Subject: [PATCH] scsi: target: Fixup two more cases for PR EARO
>>>
>>> Allow READ_CAPACITY_16 and REPORT_REFERALS for SERVICE_ACTION_IN_16
>>> in the SCSI target driver.
>>>
>>> Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
>>> ---
>>> drivers/target/target_core_pr.c | 7 +++++++
>>> 1 file changed, 7 insertions(+)
>>>
>>> diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
>>> index 83e172c92238..0b6803754422 100644
>>> --- a/drivers/target/target_core_pr.c
>>> +++ b/drivers/target/target_core_pr.c
>>> @@ -465,6 +465,13 @@ static int core_scsi3_pr_seq_non_holder(struct se_cmd *cmd, u32 pr_reg_type,
>>> return -EINVAL;
>>> }
>>> break;
>>> + case SERVICE_ACTION_IN_16:
>>> + switch (cdb[1] & 0x1f) {
>>> + case SAI_READ_CAPACITY_16:
>>> + case SAI_REPORT_REFERRALS:
>>> + ret = 0;
>>> + }
>>> + break;
>>> case ACCESS_CONTROL_IN:
>>> case ACCESS_CONTROL_OUT:
>>> case INQUIRY:
>> The patch worked fine for READ_CAPACITY_16.
>>
>> The REPORT_REFERRALS got a Check Condition with sense code 0x2000
>> (Invalid command Operation code), whether there is a PR or not,
>> because the SCSI target does not support Referrals as reported by
>> 'sg_vpd' command.
>>
>> Thanks for doing this, Ben.
>>
>> -Dai
> Thanks for the test. I'll send this to the target list, and will add your
> Tested-by unless you'd rather it withheld.
Please feel free to add me as a Tested-by tag.
Thanks,
-Dai
prev parent reply other threads:[~2025-10-09 20:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-30 16:28 [PATCH 1/1] NFSD: Fix SCSI reservation conflict causing pNFS client to revert I/O to MDS Dai Ngo
2025-09-30 19:15 ` Benjamin Coddington
2025-09-30 21:41 ` Dai Ngo
2025-10-01 10:54 ` Benjamin Coddington
2025-10-01 17:36 ` Dai Ngo
2025-10-03 6:45 ` Christoph Hellwig
2025-10-07 16:49 ` Dai Ngo
2025-10-07 15:59 ` Dai Ngo
2025-10-07 20:37 ` Benjamin Coddington
2025-10-09 17:43 ` Dai Ngo
2025-10-09 19:46 ` Benjamin Coddington
2025-10-09 20:20 ` Dai Ngo [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=2ae4be6e-50ce-496f-8b5d-63b131745848@oracle.com \
--to=dai.ngo@oracle.com \
--cc=bcodding@redhat.com \
--cc=chuck.lever@oracle.com \
--cc=hch@infradead.org \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=okorniev@redhat.com \
--cc=tom@talpey.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).