[PATCH V4 1/1] nvmet: support reservation feature

Sagi Grimberg sagi at grimberg.me
Tue Jan 30 00:49:15 PST 2024


>> Can you please explain where are the write side and read side critical
>> sections for the registrant_list and where exactly a dereference occurs
>> that is synchronized via rcu and is _not_ protected with a mutex?
>>
> 1. write:
> 
>      1) executing register、acquire、release commands.
> 
>      2)disabling namespace in nvmet_pr_exit_ns().
> 
> When doing above, I will use mutex pr_lock to protect holder and
> 
> registrant_list both, because there are multi writers.
> 
> I use rcu_dereference_protected to get holder if locked pr_lock.
> 
> 
> 2. read:
> 
>      1) executing report command, nvmet_execute_pr_report().
> 
>      2) checking admin and IO command access, nvmet_pr_check_cmd_access().
> 
> When doing above, I use rcu_read_lock to read holder and registrant_list
> 
> lightly.

Right, I ignored the REG_ONLY and ALL_REGS cases... It makes better 
sense now.



More information about the Linux-nvme mailing list