Re: [PATCH v3 2/2] NFS: Fix RCU dereference of cl_xprt in nfs_compare_super_address
From: Benjamin Coddington
Date: Tue Apr 21 2026 - 07:04:47 EST
On 19 Apr 2026, at 12:31, Sean Chang wrote:
> The cl_xprt pointer in struct rpc_clnt is marked as __rcu. Accessing
> it directly in nfs_compare_super_address() is unsafe and triggers
> Sparse warnings.
>
> Fix this by using rcu_dereference() within an RCU read-side critical
> section to retrieve the transport pointer. This addresses the sparse
> warning and ensures atomic access to the pointer, as the transport
> can be updated via transport switching even while the superblock
> remains active under sb_lock.
>
> Fixes: 7e3fcf61abde ("nfs: don't share mounts between network namespaces")
> Signed-off-by: Sean Chang <seanwascoding@xxxxxxxxx>
Reviewed-by: Benjamin Coddington <bcodding@xxxxxxxxxxxxxxx>
Ben