From patchwork Wed Feb 27 00:35:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10830943 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D3CFA139A for ; Wed, 27 Feb 2019 00:35:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B66022CCD3 for ; Wed, 27 Feb 2019 00:35:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA4FD2CF97; Wed, 27 Feb 2019 00:35:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21DB62CCD3 for ; Wed, 27 Feb 2019 00:35:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728896AbfB0Afe (ORCPT ); Tue, 26 Feb 2019 19:35:34 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:46091 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727998AbfB0Afe (ORCPT ); Tue, 26 Feb 2019 19:35:34 -0500 Received: by mail-pf1-f194.google.com with SMTP id g6so7058680pfh.13 for ; Tue, 26 Feb 2019 16:35:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OX8BBNGniam+qE6pY1y6u3S3WiDkl7ojbVNhCZKfjIg=; b=ttWc9K8PsI9GgFG1XcrP8Hqi/V8W0TEjlnxr1ZoDcfYy0PwfKvQlM5XUEKVQf5JFRG zmUZ90u21nj1qsKN+F+xlWgCveAF/81RntCAhTZuqEu4yPMWmWgo0VG7wAIosC2Rg8Ue 25s5T/z8zRTf3yHCjYzObtpp3yeLMg2iaeZ3BRRHmu+OGjwlLbeG8t4xIex3bJ+hkv3P vYfifnFanJXS/tC8gAJAA8/Gb1JzZY18V6NGFqGnQNZ9VxcgJIH9+bIKoW3EFH4vDWU8 dfw6mZjub6+1SEjl/u7tq0UmivJ+SpqKpSMW8kB6KiaGsiUA7Hh5hO6UKSztTJ7Zi8Ip qtjg== X-Gm-Message-State: AHQUAuaMM2gMvxsrj7XSgMNZMMqw4Jaayu/wwHYaI5Ctw/r5m7NtB/vp pV9/YNgODq5jb203FXaWVaQ= X-Google-Smtp-Source: AHgI3IYZJNN00XhRM9yNX/nVpHkdmrSu24Fe60QnmDTclR5dvHPzT01XWKxP7EdOkzv8ZHSrHN+++g== X-Received: by 2002:a65:6544:: with SMTP id a4mr193943pgw.412.1551227733418; Tue, 26 Feb 2019 16:35:33 -0800 (PST) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:203:5cdc:422c:7b28:ebb5]) by smtp.gmail.com with ESMTPSA id h63sm36467558pfd.148.2019.02.26.16.35.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Feb 2019 16:35:32 -0800 (PST) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Przemek Socha Subject: [PATCH] Avoid that system resume triggers a kernel warning Date: Tue, 26 Feb 2019 16:35:26 -0800 Message-Id: <20190227003526.53872-1-bvanassche@acm.org> X-Mailer: git-send-email 2.21.0.rc2.261.ga7da99ff1b-goog MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: scsi_dev_type_resume+0x2e/0x60 async_run_entry_fn+0x32/0xd8 process_one_work+0x1f4/0x420 worker_thread+0x28/0x3c0 kthread+0x118/0x130 ret_from_fork+0x22/0x40 Cc: Przemek Socha Reported-by: Przemek Socha Fixes: 3a0a529971ec ("block, scsi: Make SCSI quiesce and resume work reliably") # v4.15 Signed-off-by: Bart Van Assche --- 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 c77cb0d31dbc..c73045a5f739 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2541,7 +2541,6 @@ void scsi_device_resume(struct scsi_device *sdev) * device deleted during suspend) */ mutex_lock(&sdev->state_mutex); - WARN_ON_ONCE(!sdev->quiesced_by); sdev->quiesced_by = NULL; blk_clear_pm_only(sdev->request_queue); if (sdev->sdev_state == SDEV_QUIESCE)