[PATCH] nvmet: drop the extra RCU grace period in nvmet_ns_disable()

Christoph Hellwig hch at lst.de
Tue Nov 3 00:15:46 PST 2026


On Tue, Nov 03, 2026 at 01:31:25AM -0500, Qiliang Yuan wrote:
>  	 * Now that we removed the namespaces from the lookup list, we
>  	 * can kill the per_cpu ref and wait for any remaining references
> -	 * to be dropped, as well as a RCU grace period for anyone only
> -	 * using the namespace under rcu_read_lock().  Note that we can't
> -	 * use call_rcu here as we need to ensure the namespaces have
> -	 * been fully destroyed before unloading the module.
> +	 * to be dropped.  Rely on that wait for anyone only using the
> +	 * namespace under rcu_read_lock() too: the ref can't drop to zero
> +	 * before an RCU grace period has passed since the kill.  Note that
> +	 * we can't use call_rcu here as we need to ensure the namespaces
> +	 * have been fully destroyed before unloading the module.
>  	 */
>  	percpu_ref_kill(&ns->ref);
> -	synchronize_rcu();

This assumes the percpu_ref is never moved to atomic mode otherwise.
Which we don't do in nvmet, but maybe leaving a reminder of that here
would be useful.




More information about the Linux-nvme mailing list