Received: by 10.223.185.116 with SMTP id b49csp8121636wrg; Thu, 1 Mar 2018 17:59:57 -0800 (PST) X-Google-Smtp-Source: AG47ELsAIKPQs7H2QRdXCqE01+qJglWPgeoQwsq0bfr+F1u2ms6tIA8aaVpp/hR67+J98Q+KYd+f X-Received: by 2002:a17:902:7b85:: with SMTP id w5-v6mr3800190pll.131.1519955997747; Thu, 01 Mar 2018 17:59:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519955997; cv=none; d=google.com; s=arc-20160816; b=c0kDmSfdF79Q+Ih1gmzOR650Vst6P25fLlqJ84QI5S5cBQUxER1ay6cUiQoN9p5TVe hAmZguiNUgtWe36F5vYbKhyG5IwNeAGjScbzivDOEB8gE0rx63m97MYChtw49WdiCfS7 NH1r1lsSxY7+KxL1goFz0ikLEV1IdqacnYGhv2YvEdToN8iXtty/Ucwh2pAbAi8JXeyw p1ygRrMak2N90nMtSqc6rfb+YTcbAYorNNvDi7B8IIt4oKNF48HiGDAJOe3MBDIseCiU kirUu5IfWU+exx2UeEalx7DCzUj6+yPigI5IPU/p8Uj3MxCJo6z8VZXv3xaHXtBj21vW KAVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:organization:from:subject:cc:to :dkim-signature:arc-authentication-results; bh=GXhWp/dUv2457ZHw8H8n/Y3WeYGNd/S+uMyvApc7PXo=; b=FZF0Xm21CSnToUj1W6tWH10upQtqGCfIWBaRBFp9YYEH7ZD4wWi2rYyIvv1lMxKUII HmPoSTVucpO0EGmHdXzTbL3h6wZwGG/x+LW8zab+8+yNQFSX6YUMf8cLzuc3//tOQZxf uEh/EHKF9mh/wt1a0Pa6Hd89tm3GpvU+T+fFkffnRBhx3hFi9K5g7tK6lUK3Jw1y/u6O 4uWvP/oIQqz2XeWKYu3YGq+1sT4AYcDZsoKRS1wGRDRT2VZ5fJBYwJKuF71TX4ld2YIV FaQNTRTbu+wv1HZ24dNz+tuwyf8CKLYG0w523DB8UOSk1BQ2CkISPTN5asni1M+VWSK6 de2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=e3E1csau; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92-v6si3930595pli.623.2018.03.01.17.59.43; Thu, 01 Mar 2018 17:59:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=e3E1csau; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1164012AbeCBBsT (ORCPT + 99 others); Thu, 1 Mar 2018 20:48:19 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:59596 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163120AbeCBBsR (ORCPT ); Thu, 1 Mar 2018 20:48:17 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w221l14q004056; Fri, 2 Mar 2018 01:48:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : cc : subject : from : references : date : in-reply-to : message-id : mime-version : content-type; s=corp-2017-10-26; bh=GXhWp/dUv2457ZHw8H8n/Y3WeYGNd/S+uMyvApc7PXo=; b=e3E1csauVG/0/W8EBj//glEtTkUAtWIoY3itRf0vF72b/A/PSROQwbmruRHZq3OVsPJe svTAVOgThgaA7lxxv5xrrKTfKO9EJ+aPZPpoB/I2Ps5G5BgOswDxzbHf1k3EaAT1BJgr t4wcQCmjpCNWYv8cBcWwUq0CKMMM9cweoZ4FVex/BC7wHh1ZS7QXZIb/3l5HtdHexon0 IFEVGMYf5iWGMGAKjE9FTI2WqBpl7QDfKIlvICA4eIEwHp27P0lKfYUr0fD2EXDIaCB+ CFDK9Nu0B0JIfrHx7Bmc0g14IX06hle79f2jhw2Y1x8YNYAX3YyyWo+l5c8lWXWCRAJB +Q== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2geubn0979-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 02 Mar 2018 01:48:13 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w221hCpJ018023 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Mar 2018 01:43:12 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w221hBrj003482; Fri, 2 Mar 2018 01:43:11 GMT Received: from ca-mkp.ca.oracle.com (/10.159.214.123) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 01 Mar 2018 17:43:11 -0800 To: "jianchao.w.wang\@oracle.com" Cc: Bart Van Assche , "jejb\@linux.vnet.ibm.com" , "martin.petersen\@oracle.com" , "linux-scsi\@vger.kernel.org" , "linux-kernel\@vger.kernel.org" , "hch\@lst.de" Subject: Re: [PATCH V2] scsi: core: use blk_mq_requeue_request in __scsi_queue_insert From: "Martin K. Petersen" Organization: Oracle Corporation References: <1519808113-2863-1-git-send-email-jianchao.w.wang@oracle.com> <1519840355.2777.8.camel@wdc.com> <624cedc6-9658-7b76-9c63-61c30fdfe6be@oracle.com> <1519926225.2675.6.camel@wdc.com> Date: Thu, 01 Mar 2018 20:43:08 -0500 In-Reply-To: <1519926225.2675.6.camel@wdc.com> (Bart Van Assche's message of "Thu, 1 Mar 2018 17:43:46 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8819 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=873 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803020015 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jianchao, > Yes, the block layer core guarantees that scsi_mq_get_budget() will be > called before scsi_queue_rq(). I think the full picture is as follows: > * Before scsi_queue_rq() calls .queuecommand(), get_device() is called for the > SCSI device and the device, target and host busy counters are incremented. > * If the SCSI core decides to requeue a command, scsi_queue_insert() causes > __scsi_queue_insert() to call scsi_device_unbusy(). That last function > decreases the device, target and host busy counters but not put_device(sdev). > Hence the need for a separate put_device() call after requeuing. > > It's unfortunate that the SCSI core became so asymmetric. Anyway, > since I am now convinced that this patch is correct, feel free to add: Please add something akin to Bart's explanation as a comment and repost. Thanks! -- Martin K. Petersen Oracle Linux Engineering