[PATCH v2 5/7] nvme_fc: check connectivity before initiating reconnects

Christoph Hellwig hch at infradead.org
Thu Oct 5 01:01:39 PDT 2017


> +nvme_fc_rport_is_online(struct nvme_fc_rport *rport)
> +{
> +	unsigned long flags;
> +	bool online;
> +
> +	spin_lock_irqsave(&rport->lock, flags);
> +	online = (rport->remoteport.port_state == FC_OBJSTATE_ONLINE);
> +	spin_unlock_irqrestore(&rport->lock, flags);
> +
> +	return online;

There is no need to take a lock for reading a value <= the native
register size ever.

So just open code the check at the callsites, and with that the
patch looks fine to me.



More information about the Linux-nvme mailing list