• James Bottomley's avatar
    [SCSI] dual scan thread bug fix · f2495e22
    James Bottomley authored
    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: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
    Cc: stable@vger.kernel.org # delay backport for 2 months for field testing
    Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
    f2495e22
scsi_scan.c 56 KB