The following patches fix an issue where during iscsi recovery we deadlock due to iscsid calling into sysfs to set the device state to running, but the scsi error handler is also just finishing up. My first attempt was here: https://patchwork.kernel.org/project/linux-scsi/patch/20211006043117.11121-1-michael.christie@xxxxxxxxxx/ But the problem with that patch is that iscsid can still get stuck. This version 2 of the patchset allows the transport class to always set the device state to running after the iscsi layer has done a relogin. It then relies on a check in the second patch where if the transport class has already set the state to running, iscsid write to the state sysfs file returns without doing a rescan. I think this is hacky, but I'm not sure how else to fix the issue without breaking iscsid or the users of the new rescan behavior.