1
0
Fork 0
alistair23-linux/drivers/scsi/fcoe
Srivatsa S. Bhat cd45ae3803 scsi, fcoe: Fix CPU hotplug callback registration
Subsystems that want to register CPU hotplug callbacks, as well as perform
initialization for the CPUs that are already online, often do it as shown
below:

	get_online_cpus();

	for_each_online_cpu(cpu)
		init_cpu(cpu);

	register_cpu_notifier(&foobar_cpu_notifier);

	put_online_cpus();

This is wrong, since it is prone to ABBA deadlocks involving the
cpu_add_remove_lock and the cpu_hotplug.lock (when running concurrently
with CPU hotplug operations).

Instead, the correct and race-free way of performing the callback
registration is:

	cpu_notifier_register_begin();

	for_each_online_cpu(cpu)
		init_cpu(cpu);

	/* Note the use of the double underscored version of the API */
	__register_cpu_notifier(&foobar_cpu_notifier);

	cpu_notifier_register_done();

Fix the fcoe code in scsi by using this latter form of callback registration.

Cc: Robert Love <robert.w.love@intel.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-20 13:43:45 +01:00
..
Makefile [SCSI] libfcoe: Add fcoe_sysfs 2012-05-23 09:40:09 +01:00
fcoe.c scsi, fcoe: Fix CPU hotplug callback registration 2014-03-20 13:43:45 +01:00
fcoe.h libfc, libfcoe, fcoe: Convert debug_logging macros to pr_info 2012-12-14 10:38:55 -08:00
fcoe_ctlr.c scsi: Convert uses of compare_ether_addr to ether_addr_equal 2013-10-14 08:25:40 -07:00
fcoe_sysfs.c SCSI for-linus on 20131110 2013-11-14 12:25:38 +09:00
fcoe_transport.c SCSI for-linus on 20130713 2013-07-13 17:41:21 -07:00
libfcoe.h libfc, libfcoe, fcoe: Convert debug_logging macros to pr_info 2012-12-14 10:38:55 -08:00