]> git.baikalelectronics.ru Git - kernel.git/commit
[SCSI] dual scan thread bug fix
authorJames Bottomley <JBottomley@Parallels.com>
Tue, 21 Jan 2014 15:01:41 +0000 (07:01 -0800)
committerJames Bottomley <JBottomley@Parallels.com>
Sat, 15 Mar 2014 17:18:59 +0000 (10:18 -0700)
commit8eefc40995ebc64c25661849b8bdda82de3c06f8
treee9d1e5de350659994f7b420571deb7fed9200198
parent774ee68d2fc90bb8931dc8f36414fa9611c5b1f9
[SCSI] dual scan thread bug fix

In the highly unusual case where two threads are running concurrently through
the scanning code scanning the same target, we run into the situation where
one may allocate the target while the other is still using it.  In this case,
because the reap checks for STARGET_CREATED and kills the target without
reference counting, the second thread will do the wrong thing on reap.

Fix this by reference counting even creates and doing the STARGET_CREATED
check in the final put.

Tested-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org # delay backport for 2 months for field testing
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/scsi_scan.c