Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: target: iblock: Fix smp_processor_id() BUG messages

This has us use raw_smp_processor_id() in iblock's plug_device callout.
smp_processor_id() is not needed here, because we are running from a per
CPU work item that is also queued to run on a worker thread that is
normally bound to a specific CPU. If the worker thread did end up switching
CPUs then it's handled the same way we handle when the work got moved to a
different CPU's worker thread, where we will just end up sending I/O from
the new CPU.

Link: https://lore.kernel.org/r/20210519222640.5153-1-michael.christie@oracle.com
Fixes: 415ccd9811da ("scsi: target: iblock: Add backend plug/unplug callouts")
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Mike Christie and committed by
Martin K. Petersen
5aaeca25 8c7e7b84

+2 -2
+2 -2
drivers/target/target_core_iblock.c
··· 204 204 struct iblock_dev_plug *ib_dev_plug; 205 205 206 206 /* 207 - * Each se_device has a per cpu work this can be run from. Wwe 207 + * Each se_device has a per cpu work this can be run from. We 208 208 * shouldn't have multiple threads on the same cpu calling this 209 209 * at the same time. 210 210 */ 211 - ib_dev_plug = &ib_dev->ibd_plug[smp_processor_id()]; 211 + ib_dev_plug = &ib_dev->ibd_plug[raw_smp_processor_id()]; 212 212 if (test_and_set_bit(IBD_PLUGF_PLUGGED, &ib_dev_plug->flags)) 213 213 return NULL; 214 214