From patchwork Fri Mar 15 23:27:58 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: 10855633 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 48CB91575 for ; Fri, 15 Mar 2019 23:28:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 309162ACA6 for ; Fri, 15 Mar 2019 23:28:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 247712ACBF; Fri, 15 Mar 2019 23:28:12 +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 D997D2ACA7 for ; Fri, 15 Mar 2019 23:28:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727112AbfCOX2J (ORCPT ); Fri, 15 Mar 2019 19:28:09 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41755 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbfCOX2J (ORCPT ); Fri, 15 Mar 2019 19:28:09 -0400 Received: by mail-pg1-f196.google.com with SMTP id k11so7444574pgb.8; Fri, 15 Mar 2019 16:28:08 -0700 (PDT) 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=JGMqR8jgdtrpz+Z/QN7zHWSbDo4jTMki834i80SUaUg=; b=XqeFVSWP4m7GoykVAhq2bA9xCpLgBAl1HFdN/927gHqYHuEz2VXbl37dOpaMPktYXt g+SE6mPFX89BkLBo6fxCwjFgoPIOGWHNhRFQT4BBD59M+Rg0WgjKCMkLD6ueTwfjZOEU yTj35BdzFsLqUH5kBVbUrHM0dag2ErGSbDA8EhPSZY6tFVruaI3FhlgMXoeT1X7WX8EE I3qmQBYBGyr3anxb+O+qzhNBstIpJ7t+W0Z/FJTS8TxpxfTw3ObSKVf88NwnKBDioR+a j7IG//Fc2+Z/Rcerz1SNkqbMevS6QliVX5wgg0N9ZW5fTwFqMe29RbZcYy2AyRU4HZjD xGDg== X-Gm-Message-State: APjAAAUlUwC2kOF3VBKbj5JcOo2totY5RQqm08PfAEoJvGlbWBqnFEUf yYzD8UMloRzYAUjm5uPgMYk= X-Google-Smtp-Source: APXvYqzV4eOQKHY8iftMUyT9xaAWd1FJCYPAb05LFIkUkgnOjJQAM27bGfykMqDmCmuSG3jKlN8KWg== X-Received: by 2002:a17:902:45a5:: with SMTP id n34mr6995410pld.127.1552692488407; Fri, 15 Mar 2019 16:28:08 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:203:5cdc:422c:7b28:ebb5]) by smtp.gmail.com with ESMTPSA id c13sm5706261pfm.34.2019.03.15.16.28.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Mar 2019 16:28:06 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Jens Axboe , Bart Van Assche , Christoph Hellwig , Hannes Reinecke , Ming Lei , Johannes Thumshirn , Oleksandr Natalenko , Martin Steigerwald , stable@vger.kernel.org, Jisheng Zhang Subject: [PATCH] Avoid that a kernel warning appears during system resume Date: Fri, 15 Mar 2019 16:27:58 -0700 Message-Id: <20190315232758.221199-1-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT 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 Since scsi_device_quiesce() skips SCSI devices that have another state than RUNNING, OFFLINE or TRANSPORT_OFFLINE, scsi_device_resume() should not complain about SCSI devices that have been skipped. Hence this patch. This patch avoids that the following warning appears during resume: WARNING: CPU: 3 PID: 1039 at blk_clear_pm_only+0x2a/0x30 CPU: 3 PID: 1039 Comm: kworker/u8:49 Not tainted 5.0.0+ #1 Hardware name: LENOVO 4180F42/4180F42, BIOS 83ET75WW (1.45 ) 05/10/2013 Workqueue: events_unbound async_run_entry_fn RIP: 0010:blk_clear_pm_only+0x2a/0x30 Call Trace: ? scsi_device_resume+0x28/0x50 ? scsi_dev_type_resume+0x2b/0x80 ? async_run_entry_fn+0x2c/0xd0 ? process_one_work+0x1f0/0x3f0 ? worker_thread+0x28/0x3c0 ? process_one_work+0x3f0/0x3f0 ? kthread+0x10c/0x130 ? __kthread_create_on_node+0x150/0x150 ? ret_from_fork+0x1f/0x30 Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Ming Lei Cc: Johannes Thumshirn Cc: Oleksandr Natalenko Cc: Martin Steigerwald Cc: Reported-by: Jisheng Zhang Tested-by: Jisheng Zhang Fixes: 3a0a529971ec ("block, scsi: Make SCSI quiesce and resume work reliably") # v4.15 Signed-off-by: Bart Van Assche --- drivers/scsi/scsi_lib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 324f830ee9fa..54ad751b42b8 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2541,8 +2541,10 @@ void scsi_device_resume(struct scsi_device *sdev) * device deleted during suspend) */ mutex_lock(&sdev->state_mutex); - sdev->quiesced_by = NULL; - blk_clear_pm_only(sdev->request_queue); + if (sdev->quiesced_by) { + sdev->quiesced_by = NULL; + blk_clear_pm_only(sdev->request_queue); + } if (sdev->sdev_state == SDEV_QUIESCE) scsi_device_set_state(sdev, SDEV_RUNNING); mutex_unlock(&sdev->state_mutex);