In case (a) scsi_eh_inc_host_failed() will wake up the error handler. And in case (b) scsi_dec_host_busy() will wake up the error handler. So it's not clear to me why you think that there is a scenario in which the EH won't be woken up?
So in case (b), in my understanding, scsi_dec_host_busy can skip wakeups as it does not see host_failed change yet.
That's not correct. If scsi_dec_host_busy() obtains the SCSI host lock before scsi_eh_inc_host_failed() obtains it then the latter function will trigger a SCSI EH wakeup.
You are right! Thanks a lot for pointing that out! Now when I understand it, your patch looks good for me:
Reviewed-by: Pavel Tikhomirov ptikhomirov@virtuozzo.com
By the way, I very much like your idea of using rcu for these case.
Thanks, Pavel.
Bart.