SCSI fixes on 20171230

Two simple fixes, both of which cause I/O hangs.  The storvsc one is
 from the hyper-v which can hang under certain hot add/remove
 conditions and the other is generally, where removing a target and a
 device in close proximity can result in the release method being
 executed twice (and subsequent list and other corruption and an
 eventual panic).
 
 Signed-off-by: James E.J. Bottomley <jejb@linux.vnet.ibm.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJaSBHsAAoJEAVr7HOZEZN4CGUP/jAF44WD9sV5E0Rzx4IrFJkr
 V0n5EBNeTOE6Qqy4M5LuXkLWVBRIAnctSa73r52sMamh2vkp9t5Fp1GafYRlM+3y
 7avZ9IUXnupbIjZeiI80aq+5OK1jEdMjI/up5lqF8XiifZ+Dqp6MHQW8hTHLUaqg
 y+bT16XzZ5ziRv9wJoxIscMCqGZHucN6Dsye98mwaS4bZuIi0hdDk+piY02GlI0C
 Nf77xZtNmQXVY5R8ydEe43ci1j5GwSbIg6MjbOmhCOhurnG4NX10QlQSM9zFPDHV
 XKVQcLFpJvdNVOwvwgkuMpeqDCzlSg9n2W8HjQDFUTsFeG03t6ylVtI6iYMXbgVm
 fiedJdOFk50dw0qkBypYu425fPkX5S/rg3zv+yDBO0vc1FZxMkXInnJsgL3CMzPH
 xXpGpICNCtcFmLpCbgyxjc4fcfWHwSsgqW0fD/NWcP//CcsUsOAgmM9HJw9jp+sM
 AqBonDGpm+E8EU1It2qxHl5uSfaGRL1aZ8kL0EbOpYM07XSIW/diZ0l0+Ma2MLq9
 lyKJsFmRt1I65aW36cT79SHEtArjtCBn9z184MO/9GyhLz5JxSk3CZ4KWo5eci8n
 PWZyArt7LyFojNZhjT3MEflidr/HlecB4M6XLbYtba1A8oYeNE3NwueCrPz3gjAC
 BCYPbM8Nx9IIarOy3pw7
 =Dqbu
 -----END PGP SIGNATURE-----

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "Two simple fixes, both of which cause I/O hangs.

  The storvsc one is from the hyper-v which can hang under certain hot
  add/remove conditions and the other is generally, where removing a
  target and a device in close proximity can result in the release
  method being executed twice (and subsequent list and other corruption
  and an eventual panic)"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: storvsc: Fix scsi_cmd error assignments in storvsc_handle_error
  scsi: core: check for device state in __scsi_remove_target()
This commit is contained in:
Linus Torvalds 2017-12-30 14:31:30 -08:00
commit 71ee203389
2 changed files with 6 additions and 2 deletions

View File

@ -1415,7 +1415,10 @@ static void __scsi_remove_target(struct scsi_target *starget)
* check.
*/
if (sdev->channel != starget->channel ||
sdev->id != starget->id ||
sdev->id != starget->id)
continue;
if (sdev->sdev_state == SDEV_DEL ||
sdev->sdev_state == SDEV_CANCEL ||
!get_device(&sdev->sdev_gendev))
continue;
spin_unlock_irqrestore(shost->host_lock, flags);

View File

@ -953,10 +953,11 @@ static void storvsc_handle_error(struct vmscsi_request *vm_srb,
case TEST_UNIT_READY:
break;
default:
set_host_byte(scmnd, DID_TARGET_FAILURE);
set_host_byte(scmnd, DID_ERROR);
}
break;
case SRB_STATUS_INVALID_LUN:
set_host_byte(scmnd, DID_NO_CONNECT);
do_work = true;
process_err_fn = storvsc_remove_lun;
break;