scsi: core: Avoid that system resume triggers a kernel warning [Linux 5.0]

scsi: core: Avoid that system resume triggers a kernel warning [Linux 5.0]

This Linux kernel change "scsi: core: Avoid that system resume triggers a kernel warning" is included in the Linux 5.0 release. This change is authored by Bart Van Assche <bvanassche [at]> on Tue Feb 26 16:35:26 2019 -0800. The commit for this change in Linux stable tree is 388b4e6 (patch).

scsi: core: Avoid that system resume triggers a kernel warning

scsi_device_quiesce() and scsi_device_resume() are called during
system-wide suspend and resume. scsi_device_quiesce() only succeeds for
SCSI devices that are in one of the RUNNING, OFFLINE or TRANSPORT_OFFLINE
states (see also scsi_set_device_state()).  This patch avoids that the
following warning is triggered when resuming a system for which quiescing a
SCSI device failed:

WARNING: CPU: 2 PID: 11303 at drivers/scsi/scsi_lib.c:2600 scsi_device_resume+0x4f/0x58
CPU: 2 PID: 11303 Comm: kworker/u8:70 Not tainted 5.0.0-rc1+ #50
Hardware name: LENOVO 80E3/Lancer 5B2, BIOS A2CN45WW(V2.13) 08/04/2016
Workqueue: events_unbound async_run_entry_fn
Call Trace:

Cc: Przemek Socha <[email protected]>
Reported-by: Przemek Socha <[email protected]>
Fixes: 3a0a529971ec ("block, scsi: Make SCSI quiesce and resume work reliably") # v4.15
Signed-off-by: Bart Van Assche <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>

There is one line of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/scsi/scsi_lib.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f8d51c3..a6828391d 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2598,7 +2598,6 @@ void scsi_device_resume(struct scsi_device *sdev)
     * device deleted during suspend)
-   WARN_ON_ONCE(!sdev->quiesced_by);
    sdev->quiesced_by = NULL;
    if (sdev->sdev_state == SDEV_QUIESCE)

Leave a Reply

Your email address will not be published. Required fields are marked *