On Tue, Oct 06, 2026 at 08:01:07PM +0200, Miklos Szeredi wrote:
> Make sure that a non-NULL check in callers remains valid even when racing
> with fs_put_dax().


Hi Miklos,

I understand this is in preparation for the new FUSE DAX backing support, yet it
does need a changelog that stands on its own.

As written, it suggests that READ_ONCE() makes a non-NULL result safe against
concurrent fs_put_dax(). However, READ_ONCE() only controls the pointer load, 
but
IIUC it does not protect the lifetime of the returned holder.

Could the changelog explain what READ_ONCE() provides and describe the intended
RCU-protected access? Include what guarantees that the holder remains valid
while it is being used.

Also, is this RCU-based lifetime handling specific to the new FUSE 
implementation,
or is it intended to establish a general requirement for DAX holders and callers
of dax_holder()?

-- Alison


> 
> Signed-off-by: Miklos Szeredi <[email protected]>
> ---
>  drivers/dax/super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dax/super.c b/drivers/dax/super.c
> index 824e1f6df378..0a440f8b42e4 100644
> --- a/drivers/dax/super.c
> +++ b/drivers/dax/super.c
> @@ -677,7 +677,7 @@ EXPORT_SYMBOL_GPL(put_dax);
>   */
>  void *dax_holder(struct dax_device *dax_dev)
>  {
> -     return dax_dev->holder_data;
> +     return READ_ONCE(dax_dev->holder_data);
>  }
>  EXPORT_SYMBOL_GPL(dax_holder);
>  
> -- 
> 2.54.0
> 
> 

Reply via email to