Received: by 10.223.185.116 with SMTP id b49csp8140407wrg; Thu, 1 Mar 2018 18:25:06 -0800 (PST) X-Google-Smtp-Source: AG47ELtY+oJxpsrp3g/KWfSzsLX9geQgWgAlVqg1Z1s1ysOu+q+LuANWQKr1jfwJdRdpxO15/zYX X-Received: by 10.99.116.25 with SMTP id p25mr3285888pgc.109.1519957505851; Thu, 01 Mar 2018 18:25:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519957505; cv=none; d=google.com; s=arc-20160816; b=rm83l8x2d7bT2+yYdtfsjUukFSBy0n6ib4tK7lXLC+x1IQmJP7abDobbHLS7th4vSE 4mSJ/8hIBI2CnM6F91QipIKZeKH634v+gbK0bqI01G9jQeYq7vyyhEx/OgmIZeLA+KFM l0MZBTxxEIa0LFhyI7g2J8I9N1YjkzpZjHEvefKVQ7xK8lxON1hUjO86rFbzcuBeVXR+ lsmDxULZbBpcK5NSt3PuSsdJEbfIbLt9XnVl5PJDxxZGye3kUZt1W/dUrRXk6UTi/hKq 8YghYXBCEe+dVPja4fGaUr9rdIEIg/xSqKtrAjo0hAU1PHcsCog45h3wZT8sJU99OF39 iF8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=9auJjdUTEHtsVu3XkIIdUTmiCIK4d52ETtPY/0KNLNM=; b=Rkh+xfTjsBlmBlFoGEGdh1KQbUVuaURF+7CnMooH5/x+/3dPKthS23sIqXOZ8IGze1 cYnDEEz4duTBwdpyUC9P7TXwZgcUfDtfef7tE1A0IXR23axab3HpEXc3muOj1Bj4mZp3 T8FWG+AMWOYbEshnhhNQzc3X5+xN5mI4abYQ0F0bki/oRZf+1Lx78ViShG9+clIb0vcw 3iPlvuYsP5KY6KbInP71I3f1uvIMsI/FcAIJ403KR+Cw1n37km72CBEAdggt0aIbl88B kT+oJshMj2y2BAoG4O2TH6vdO3PanH6cy9uU7D3WnqY9iNxm+1Crr4HjBnEpqK3IEDBV nlSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=apOcXYbS; 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 w10si3270798pgr.136.2018.03.01.18.24.51; Thu, 01 Mar 2018 18:25:05 -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=apOcXYbS; 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 S1164239AbeCBCRd (ORCPT + 99 others); Thu, 1 Mar 2018 21:17:33 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:51580 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163939AbeCBCRb (ORCPT ); Thu, 1 Mar 2018 21:17:31 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w222CjHH135345; Fri, 2 Mar 2018 02:17:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=9auJjdUTEHtsVu3XkIIdUTmiCIK4d52ETtPY/0KNLNM=; b=apOcXYbSFzCM00R+Gq8w8d1oJZ9kW0VAXWhrS/gf7rdRLwFrImDQ8B8AGQm/Z8WQSul8 DcGjdJhr2cQd6EdY42ckreQa20yuYEOvCCd6QJJqqOEX5Y7nUrSY0qNO0jnCNkoNVTWa 5gf4k1b3QXC79OnCj/uHjTEG8lb7FWiytJDdQ5d+wKt/41K2zvZJn6o0lLJ1k9Qye+pu RizytlVc3s2mjAghXumg+2Lh1tExNqJfuxbuvG0NSuMpgTKoL030ztk9jOd1CeINU6mQ E/X2nkjDsdmSN6x1f+FVvJtERmc+V0hZkUSbupX4w/HJDYnI9CTIVgqufjKT2IRy0Wve 6w== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2gewcfg1vr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 02 Mar 2018 02:17:27 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w222HQWl015190 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Mar 2018 02:17:26 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w222HP98017801; Fri, 2 Mar 2018 02:17:25 GMT Received: from [10.182.69.179] (/10.182.69.179) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 01 Mar 2018 18:17:25 -0800 Subject: Re: [PATCH V2] scsi: core: use blk_mq_requeue_request in __scsi_queue_insert To: "Martin K. Petersen" Cc: Bart Van Assche , "jejb@linux.vnet.ibm.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "hch@lst.de" 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> From: "jianchao.wang" Message-ID: <1bb1537c-3427-b56d-c296-aa9b101262e3@oracle.com> Date: Fri, 2 Mar 2018 10:17:24 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803020021 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi martin Thanks for your kindly response. On 03/02/2018 09:43 AM, Martin K. Petersen wrote: > > 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. yes, sure. Thanks Jianchao