]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.0/scsi-core-avoid-that-a-kernel-warning-appears-during-system-resume.patch
53a8e51695513295b934f6c8afdcda0ff9285b4b
[thirdparty/kernel/stable-queue.git] / queue-5.0 / scsi-core-avoid-that-a-kernel-warning-appears-during-system-resume.patch
1 From 17605afaae825b0291f80c62a7f6565879edaa8a Mon Sep 17 00:00:00 2001
2 From: Bart Van Assche <bvanassche@acm.org>
3 Date: Fri, 15 Mar 2019 16:27:58 -0700
4 Subject: scsi: core: Avoid that a kernel warning appears during system resume
5
6 From: Bart Van Assche <bvanassche@acm.org>
7
8 commit 17605afaae825b0291f80c62a7f6565879edaa8a upstream.
9
10 Since scsi_device_quiesce() skips SCSI devices that have another state than
11 RUNNING, OFFLINE or TRANSPORT_OFFLINE, scsi_device_resume() should not
12 complain about SCSI devices that have been skipped. Hence this patch. This
13 patch avoids that the following warning appears during resume:
14
15 WARNING: CPU: 3 PID: 1039 at blk_clear_pm_only+0x2a/0x30
16 CPU: 3 PID: 1039 Comm: kworker/u8:49 Not tainted 5.0.0+ #1
17 Hardware name: LENOVO 4180F42/4180F42, BIOS 83ET75WW (1.45 ) 05/10/2013
18 Workqueue: events_unbound async_run_entry_fn
19 RIP: 0010:blk_clear_pm_only+0x2a/0x30
20 Call Trace:
21 ? scsi_device_resume+0x28/0x50
22 ? scsi_dev_type_resume+0x2b/0x80
23 ? async_run_entry_fn+0x2c/0xd0
24 ? process_one_work+0x1f0/0x3f0
25 ? worker_thread+0x28/0x3c0
26 ? process_one_work+0x3f0/0x3f0
27 ? kthread+0x10c/0x130
28 ? __kthread_create_on_node+0x150/0x150
29 ? ret_from_fork+0x1f/0x30
30
31 Cc: Christoph Hellwig <hch@lst.de>
32 Cc: Hannes Reinecke <hare@suse.com>
33 Cc: Ming Lei <ming.lei@redhat.com>
34 Cc: Johannes Thumshirn <jthumshirn@suse.de>
35 Cc: Oleksandr Natalenko <oleksandr@natalenko.name>
36 Cc: Martin Steigerwald <martin@lichtvoll.de>
37 Cc: <stable@vger.kernel.org>
38 Reported-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
39 Tested-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
40 Fixes: 3a0a529971ec ("block, scsi: Make SCSI quiesce and resume work reliably") # v4.15
41 Signed-off-by: Bart Van Assche <bvanassche@acm.org>
42 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
43 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
44
45 ---
46 drivers/scsi/scsi_lib.c | 6 ++++--
47 1 file changed, 4 insertions(+), 2 deletions(-)
48
49 --- a/drivers/scsi/scsi_lib.c
50 +++ b/drivers/scsi/scsi_lib.c
51 @@ -2598,8 +2598,10 @@ void scsi_device_resume(struct scsi_devi
52 * device deleted during suspend)
53 */
54 mutex_lock(&sdev->state_mutex);
55 - sdev->quiesced_by = NULL;
56 - blk_clear_pm_only(sdev->request_queue);
57 + if (sdev->quiesced_by) {
58 + sdev->quiesced_by = NULL;
59 + blk_clear_pm_only(sdev->request_queue);
60 + }
61 if (sdev->sdev_state == SDEV_QUIESCE)
62 scsi_device_set_state(sdev, SDEV_RUNNING);
63 mutex_unlock(&sdev->state_mutex);