Re: [PATCHv2 05/17] nvme: add Clang context annotations for nvme_ns_head::current_path

From: Christoph Hellwig

Date: Fri Jun 26 2026 - 02:41:02 EST


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)

?