[PATCH 0/2] nvmet: add namespace-level debugfs for reservation state

Guixin Liu kanie at linux.alibaba.com
Thu Jun 25 02:10:33 PDT 2026



在 2026/6/25 15:17, Daniel Wagner 写道:
> On Mon, Jun 22, 2026 at 06:44:16PM +0800, Guixin Liu wrote:
>> This series adds debugfs support for inspecting NVMe target reservation
>> (PR) state at the namespace level.
>>
>> Patch 1 introduces per-namespace debugfs directories under each subsystem,
>> providing the infrastructure for namespace-specific debug entries.
>>
>> Patch 2 adds a 'reservation' file that exposes the persistent reservation
>> state including enable status, generation counter, holder information, and
>> the full registrant list.
>>
>> Example output with two registered hosts and an active holder:
>>
>>    $ cat /sys/kernel/debug/nvmet/testnqn/ns1/reservation
>>    enable : 1
>>    generation : 2
>>    notify_mask : 0x0
>>    rtype : write_exclusive
>>    holder : hostid=11111111-1111-1111-1111-111111111111, rkey=0x1111
>>    registrants:
>>      hostid=11111111-1111-1111-1111-111111111111, rkey=0x1111
>>      hostid=22222222-2222-2222-2222-222222222222, rkey=0x2222
> I expect blktests will make use of this interface eventually. The parser
> for this wont be dead simple, sure doable but not simple. If you see a
> way to make a bit simpler I wouldn't mind.
How about this:

1. One holer, multi registrants:
   enable=1
   generation=2
   notify_mask=0x0
   rtype=write_exclusive
   holder=11111111-1111-1111-1111-111111111111,0x1111
   reg=11111111-1111-1111-1111-111111111111,0x1111
   reg=22222222-2222-2222-2222-222222222222,0x2222

2. No holder, multi registrants:
   enable=1
   generation=1
   notify_mask=0x0
   rtype=none
   holder=none
   reg=11111111-1111-1111-1111-111111111111,0x1111
   reg=22222222-2222-2222-2222-222222222222,0x2222

3. No registrant:
   enable=1
   generation=0
   notify_mask=0x0
   rtype=none
   holder=none

4. Reservation not enabled:
   enable=0

Otherwise, the notify_mask can be stringization:

   notify_mask=reg_preempted,resv_released,resv_preempted

Best Regards,
Guixin Liu




More information about the Linux-nvme mailing list