From patchwork Fri Sep 1 03:45:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9933405 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D5D6C6038C for ; Fri, 1 Sep 2017 03:45:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1C0028417 for ; Fri, 1 Sep 2017 03:45:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C67A328420; Fri, 1 Sep 2017 03:45:50 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 86D622841D for ; Fri, 1 Sep 2017 03:45:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751086AbdIADpt (ORCPT ); Thu, 31 Aug 2017 23:45:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51662 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750762AbdIADps (ORCPT ); Thu, 31 Aug 2017 23:45:48 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BAC165F723; Fri, 1 Sep 2017 03:45:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BAC165F723 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ming.lei@redhat.com Received: from ming.t460p (ovpn-12-73.pek2.redhat.com [10.72.12.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8DE8277D4C; Fri, 1 Sep 2017 03:45:37 +0000 (UTC) Date: Fri, 1 Sep 2017 11:45:33 +0800 From: Ming Lei To: Oleksandr Natalenko Cc: Jens Axboe , linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , linux-scsi@vger.kernel.org, "Martin K . Petersen" , "James E . J . Bottomley" Subject: Re: [PATCH 0/9] block/scsi: safe SCSI quiescing Message-ID: <20170901034532.GD16525@ming.t460p> References: <20170831172728.15817-1-ming.lei@redhat.com> <1576539.niWZoWEnd8@natalenko.name> <20170831173833.GC5928@ming.t460p> <14328863.IIXMb7O2AM@natalenko.name> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <14328863.IIXMb7O2AM@natalenko.name> User-Agent: Mutt/1.8.3 (2017-05-23) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 01 Sep 2017 03:45:48 +0000 (UTC) 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 On Thu, Aug 31, 2017 at 08:31:54PM +0200, Oleksandr Natalenko wrote: > Tested against v4.13-rc7. With this patchset it looks like I/O doesn't hang, > but once (just once, not each time) I've got the following stacktrace on > resume: That looks not bad, and thanks for your test! Could you try the following patch against this patchset to see if there is still the warning? diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index b9ad8aeb456f..bbd85ddad18c 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -243,11 +243,12 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, struct request *req; struct scsi_request *rq; int ret = DRIVER_ERROR << 24; + unsigned flag = sdev->sdev_state == SDEV_QUIESCE ? BLK_REQ_PREEMPT : 0; req = __blk_get_request(sdev->request_queue, data_direction == DMA_TO_DEVICE ? REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, __GFP_RECLAIM, - BLK_REQ_PREEMPT); + flag); if (IS_ERR(req)) return ret; rq = scsi_req(req); @@ -2931,11 +2932,6 @@ EXPORT_SYMBOL(scsi_device_quiesce); */ void scsi_device_resume(struct scsi_device *sdev) { - /* wait for completion of IO issued during SCSI quiese */ - blk_freeze_queue_wait(sdev->request_queue); - - blk_unfreeze_queue(sdev->request_queue); - /* check if the device state was mutated prior to resume, and if * so assume the state is being managed elsewhere (for example * device deleted during suspend) @@ -2945,6 +2941,11 @@ void scsi_device_resume(struct scsi_device *sdev) scsi_device_set_state(sdev, SDEV_RUNNING) == 0) scsi_run_queue(sdev->request_queue); mutex_unlock(&sdev->state_mutex); + + /* wait for completion of IO issued during SCSI quiese */ + blk_freeze_queue_wait(sdev->request_queue); + + blk_unfreeze_queue(sdev->request_queue); } EXPORT_SYMBOL(scsi_device_resume);