[PATCH 1/1] nvme/fc: add 'discovery' sysfs attribute to fc transport device

Hannes Reinecke hare at suse.de
Wed Nov 8 08:31:23 PST 2017


On 11/07/2017 08:25 PM, Christoph Hellwig wrote:
>> +	list_for_each_entry(lport, &nvme_fc_lport_list, port_list) {
>> +		list_for_each_entry_safe(rport, tmp_rport,
>> +					 &lport->endp_list, endp_list) {
>> +			if (!nvme_fc_rport_get(rport))
>> +				continue;
>> +			spin_unlock_irqrestore(&nvme_fc_lock, flags);
>> +			nvme_fc_signal_discovery_scan(lport, rport);
>> +			nvme_fc_rport_put(rport);
>> +			spin_lock_irqsave(&nvme_fc_lock, flags);
>> +		}
>> +	}
>> +	spin_unlock_irqrestore(&nvme_fc_lock, flags);
> 
> What guarantees the list next pointers are still valid after
> you dropped nvme_fc_lock?
> 
You know, I wondered about that, too.
But then I cannot hold the lock when calling nvme_fc_rport_put().
And I'm somewhat reluctant to use list_for_each_entry_safe() in the
outer loop.

I'll be checking what we can do here.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare at suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)



More information about the Linux-nvme mailing list