[PATCHv2 05/17] nvme: add Clang context annotations for nvme_ns_head::current_path
Nilay Shroff
nilay at linux.ibm.com
Fri Jun 26 08:35:56 PDT 2026
On 6/26/26 12:10 PM, Christoph Hellwig wrote:
> On Sun, Jun 14, 2026 at 06:45:20PM +0530, Nilay Shroff wrote:
>> +++ b/drivers/nvme/host/multipath.c
>> @@ -231,8 +231,16 @@ bool nvme_mpath_clear_current_path(struct nvme_ns *ns)
>> bool changed = false;
>> int node;
>>
>> + /*
>> + * This helper is used by namespace failover/teardown and I/O policy
>> + * update paths. We only compare the head->current_path[] pointer value
>> + * and do not dereference the referenced namespace, so suppress the
>> + * context analysis warning for this lockless inspection of the
>> + * __rcu_guarded pointer.
>> + */
>> for_each_node(node) {
>> - if (ns == rcu_access_pointer(head->current_path[node])) {
>> + if (context_unsafe(ns ==
>> + rcu_access_pointer(head->current_path[node]))) {
>
> I think we need a helper for this, as for a simple pointer value
> comparison without a dereference we don't really need either
> rcu_access_pointer nor locking.
>
> Maybe somthing like a
>
> rcu_compare_pointer(rcu_pointer, nonrcu_pointer)
>
> ?
Probably a good idea to have such helper. And if it's implemented
then it should be wrapped under contetx_unsafe() as is done for
other rcu helpers. But lets wait for Paul/Marco to comment on it.
Thanks,
--Nilay
More information about the Linux-nvme
mailing list