libata: make ata_print_id atomic
This variable is incremented from multiple contexts (module_init via libata-lldds and the libsas discovery thread). Make it atomic to head off any chance of libsas and libata creating duplicate ids. Acked-by: Jacek Danecki <jacek.danecki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
This commit is contained in:

committed by
Jeff Garzik

parent
99b80e9771
commit
85d6725b7c
@@ -3843,7 +3843,7 @@ int ata_sas_async_port_init(struct ata_port *ap)
|
||||
int rc = ap->ops->port_start(ap);
|
||||
|
||||
if (!rc) {
|
||||
ap->print_id = ata_print_id++;
|
||||
ap->print_id = atomic_inc_return(&ata_print_id);
|
||||
__ata_port_probe(ap);
|
||||
}
|
||||
|
||||
@@ -3867,7 +3867,7 @@ int ata_sas_port_init(struct ata_port *ap)
|
||||
int rc = ap->ops->port_start(ap);
|
||||
|
||||
if (!rc) {
|
||||
ap->print_id = ata_print_id++;
|
||||
ap->print_id = atomic_inc_return(&ata_print_id);
|
||||
rc = ata_port_probe(ap);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user