Received: by 10.223.185.116 with SMTP id b49csp8179430wrg; Thu, 1 Mar 2018 19:21:13 -0800 (PST) X-Google-Smtp-Source: AG47ELvvnaYqdEE2dtGBKG8ZMC8uL8kJftmQyYbId1gM60DcZgHbUmsXW3Od+dvhurc/dPHcodb7 X-Received: by 2002:a17:902:6c4c:: with SMTP id h12-v6mr3883060pln.101.1519960873223; Thu, 01 Mar 2018 19:21:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519960873; cv=none; d=google.com; s=arc-20160816; b=LM8HPyXgybF8Dw7wRNsoIMXAtXNSLOspBRSkOiHXl8aWK7JNCcP3uU4vJZIflHQTYB Fucm2taDMLMP8sr0GUQ8jprdjSZn0ky02D9q34AGhq7dDlepHrdXk+TvnHQyrDYxulJe hFjG+NHET5n2u9CHgUbkGhUwkn59eg8WB8m+GsGCO4GAYkeWOqcZuCHmMuSJDlURpHu7 PuWISGCY7Yhp2zym3pFGBih0CjALfjLXzqRv/bqdyHbHWRh9wdHh33/JjsOVUa6IWDI8 JucotneUMLseEhQqvZCRuZJ3LwJU4ookDsmwK2TkmwE4VkKwX3VSQDVNc7b2uyvc+YYC fyKQ== 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=69mDLSu6LZrgSRh/IL0Ix9cqgXO1amEKm5w2ijn3T0E=; b=DMLP8Lb23YV0n/NQ79o5Fl434SlRitLr68gBPKTJa0zV6U/05YRAbfn+MtDEPxqsgQ lLZt2ambdScUInPr+M0mV9330zCaQEq9SkNKCnWnXCIVf4feHOJOoTMmTZVaDluRJ9B8 5IvtwLzeeCaUkbf6MGk/gHjCs2bM4pmc3js5YwVR+215trRbLQIg5cwqW71h0UJv1bc1 24VxiaGfSdlGv0rPb8kHuReILyEk8cTgB2ueJx1qy2dsl3nrR3h7VDCoDVlIgVa4bfrm 0M4e8NrPuASmcqxcDSIWpWIk5X0dfRg/kEOyBwdStu7UR40RgLUB7+Sb4W/xg4BNuCLW KjAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=eLO0MfCw; 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 s16-v6si4017245plp.358.2018.03.01.19.20.58; Thu, 01 Mar 2018 19:21:13 -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=eLO0MfCw; 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 S1164217AbeCBCQp (ORCPT + 99 others); Thu, 1 Mar 2018 21:16:45 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:55152 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163939AbeCBCQn (ORCPT ); Thu, 1 Mar 2018 21:16:43 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w222C2Ne166730; Fri, 2 Mar 2018 02:16:40 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=69mDLSu6LZrgSRh/IL0Ix9cqgXO1amEKm5w2ijn3T0E=; b=eLO0MfCw7rMY8VzSoiuquIIoqTiM3M3xdlu4CKwaPq894t9PRJlsg9VQKbsXdODoaOYc QH0ycAEf1scS6VwdWOKW95ABt1bt0zUVPKOT3v2TzU+J1ndTsY+WemVfzvemQ9vHxj0C fhDw18gCzMNbC9XcvT2MdxumQojry7NsxpYvDff9bwuamiqFJ3h9z5jTnBRlGOhS3pcM DBlyEW2G9jYEofFt/IVnDH9BZicsFtG87n1wKH6W+pP3xllfOfXlOdRx87rTARaI/1xl B5iG7KRcD2JEcI/1u2c9v8cenK666CQxcS2jbR8NAVo9pjeQPtQzVOUs1Lz8kNVTJx40 sQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2gewef81ah-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 02 Mar 2018 02:16:40 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w222Gd84013739 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Mar 2018 02:16:40 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w222GdXY029817; Fri, 2 Mar 2018 02:16:39 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:16:38 -0800 Subject: Re: [PATCH V2] scsi: core: use blk_mq_requeue_request in __scsi_queue_insert To: Bart Van Assche , "jejb@linux.vnet.ibm.com" , "martin.petersen@oracle.com" Cc: "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: Date: Fri, 2 Mar 2018 10:16:37 +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: <1519926225.2675.6.camel@wdc.com> 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 Bart Thanks for your precious time and detailed summary. On 03/02/2018 01:43 AM, Bart Van Assche wrote: > 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. Supply some details here: scsi_mq_get_budget before calling .queuecommand get_device and increase device_busy. scsi_queue_rq increases target_busy and host_busy. > * 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: > > Reviewed-by: Bart Van Assche Sincerely Jianchao