]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - drivers/scsi/scsi_lib.c
scsi: core: Ensure that the SCSI error handler gets woken up
authorBart Van Assche <bart.vanassche@wdc.com>
Mon, 4 Dec 2017 18:06:23 +0000 (10:06 -0800)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 22 Feb 2018 14:21:55 +0000 (08:21 -0600)
commitaf2f8f5f495f7010b61bbf33d0191eac3ffd058a
tree0a3724043a6f645a075a4b960868e55e245d41df
parent4be997ec6ce94b64df83cffc8ee84ed8ace98220
scsi: core: Ensure that the SCSI error handler gets woken up

BugLink: http://bugs.launchpad.net/bugs/1751064
commit 3bd6f43f5cb3714f70c591514f344389df593501 upstream.

If scsi_eh_scmd_add() is called concurrently with
scsi_host_queue_ready() while shost->host_blocked > 0 then it can
happen that neither function wakes up the SCSI error handler. Fix
this by making every function that decreases the host_busy counter
wake up the error handler if necessary and by protecting the
host_failed checks with the SCSI host lock.

Reported-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
References: https://marc.info/?l=linux-kernel&m=150461610630736
Fixes: commit 746650160866 ("scsi: convert host_busy to atomic_t")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Tested-by: Stuart Hayes <stuart.w.hayes@gmail.com>
Cc: Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: Stuart Hayes <stuart.w.hayes@gmail.com>
Cc: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/scsi/hosts.c
drivers/scsi/scsi_error.c
drivers/scsi/scsi_lib.c
include/scsi/scsi_host.h