Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1624874imm; Thu, 14 Jun 2018 00:50:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJHOPq+BDFep/EC5mS63BrqarLdbcdkgU6xSWQo8febcT4e3JHkr0BsBj6tjdG/EUNdvZt1 X-Received: by 2002:a65:60c2:: with SMTP id r2-v6mr1365680pgv.324.1528962631746; Thu, 14 Jun 2018 00:50:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528962631; cv=none; d=google.com; s=arc-20160816; b=qNUhQqp8ZlvsmUB/n0a2hCZS0VupE7Evt8EdIi2BQkP70OaFdcwFyF3MKwuknubMl9 w8APzo49DMpxLuQZ2+rt5p7OUMmCn7FpYY0p2ZrogMQ06tHt+KRnYKuOigOPEWzVGOtL SNKJfRoxZhMzkn6laEUGalrhe35ksKqyHw3RzZCC3c9Ya51w0vJ8Ck+4rr/yqvSVY/K9 u78nQHVAYnIL4ZbbP3++6B3pRwW3DLdVsGNQ9ol80/7ESLWnAY53tLQHxPcTfobMuqSf +cOh0tmJgE6LfkZP7C9oQGRZ7eZlyuGKfx7clbgpsWjTJRaw7TKiFDh+Rpp1UsZguYFY lDyQ== 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=7+J8vEpLZxbjSUk8Vu+Dk5iP0UDFZxVHFRoFHoNmJsI=; b=EiiFz4HtaRmTnr5rK8/od5sIPAIrMblJv0UhRE7La1izO1GRpow5LExmUUjULavhdh 0bVJGeM8I8IXecaO7J+AaT5nc6M9MeomB6cPf1poCJnhy0UZK8jZcqnm6G3G4cfz3zsy zie9mVgPDxaZ5pO6j/q4ZOOBQCcsB9nkpnZ0UiazAhm5VRpxB4dXovgR7zENxi4uZey+ 3dg0gOcd5pPdDSaG8/jyB23QwvGycZlt54DMPLokWkIj0Xc6iRn8kLw7wScZLiN8Ltwl iiAO+QwLTRZ260I89rubKvBQ2b2GjYmOj3IMydCb9dETeTtbzX3fkuGKZtz6HX6TEP+q 0Bjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=cyxzJhqF; 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 n15-v6si4103740pgf.45.2018.06.14.00.50.17; Thu, 14 Jun 2018 00:50:31 -0700 (PDT) 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=cyxzJhqF; 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 S1754609AbeFNHtl (ORCPT + 99 others); Thu, 14 Jun 2018 03:49:41 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:37354 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752759AbeFNHtj (ORCPT ); Thu, 14 Jun 2018 03:49:39 -0400 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 w5E7mlX6039406; Thu, 14 Jun 2018 07:49:20 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=7+J8vEpLZxbjSUk8Vu+Dk5iP0UDFZxVHFRoFHoNmJsI=; b=cyxzJhqFfvFWRicjaYkRKTAEJA0j1DiMEviUBf8kpIr52NP669o5LG2aflE5PSWNM+aq qpsmga9+B+0iOlMQM6mKm2DoOpMkkXzRYZM3jYETN2f/zhAfPw4QDQKZkq0VXE14n7Wd WiHCAXOrMdrE7x3fG5aiG5WUAyo03GvwWVXEXNa6DF847vZzFn6jdiKjaplPB1nGFvUx BTWWo8m/UQI3O1P+Ze+Py25pvUQTSdnsf2IX2kfCgaGjfyfr7frOm6Jaxg6HnzwWqiOQ Tk2I8DgL9L1BzzdkFJWcaW7I2LQC38rKhHP6MikWsMY5NFxGI6LWAvxuYJLTqopmFTOE zw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2jk0xrbv5y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Jun 2018 07:49:20 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5E7nJqb009028 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Jun 2018 07:49:19 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w5E7nHkp027704; Thu, 14 Jun 2018 07:49:17 GMT Received: from [10.182.69.179] (/10.182.69.179) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 14 Jun 2018 00:49:17 -0700 Subject: Re: kernel BUG at drivers/scsi/scsi_error.c:197! - git 4.17.0-x64-08428-g7d3bf613e99a To: "hch@lst.de" , Bart Van Assche Cc: "randrianasulu@gmail.com" , "rdunlap@infradead.org" , "linux-kernel@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-block@vger.kernel.org" References: <201806091606.51078.randrianasulu@gmail.com> <025bf705-15b0-65e5-4b16-6c91d41c1730@infradead.org> <40617b19667b3c1302f8a903c19f2fa2f409b12a.camel@wdc.com> <5ca74fb7-af70-31c3-0e3f-bace058e5a57@oracle.com> <20180613140411.GA32701@lst.de> <09e8bd7605febd091679172d68ca1e9ca3990c91.camel@wdc.com> <20180613143558.GA1163@lst.de> From: "jianchao.wang" Message-ID: <77932f7b-08ba-7ece-3778-d7da82772057@oracle.com> Date: Thu, 14 Jun 2018 15:49:28 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180613143558.GA1163@lst.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8923 signatures=668702 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-1805220000 definitions=main-1806140092 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Christoph On 06/13/2018 10:35 PM, hch@lst.de wrote: > On Wed, Jun 13, 2018 at 02:08:12PM +0000, Bart Van Assche wrote: >> __blk_mq_complete_request() is already called today by blk_mq_complete_request(). >> However, it's not clear to me why that function is exported by Jianchao's patch. > > True. I had missed that the patch also started calling the new > mark_rq_complete function from the error handler. > >> The SCSI error handler already waits until all pending requests have finished >> before it starts handling timed out commands. This e-mail thread started with a >> report of a crash in the SCSI error handler, which is a regression introduced in >> the v4.18 merge window. > > ut-requests-again-that-are-in-the.patch > Yeah. I've read back a bit. If your theory of a double invocation of > the timeout handler is correct something like the patch below should sort > it out, right? Yes, it will work for this issue. But we should also clear the RQF_TIMED_OUT in __blk_mq_requeue_request and blk_mq_rq_ctx_init. Thanks Jianchao > > --- >>From d408928360f087c0ad24e31d1d25533c698b8b35 Mon Sep 17 00:00:00 2001 > From: Christoph Hellwig > Date: Wed, 13 Jun 2018 16:25:40 +0200 > Subject: blk-mq: don't time out requests again that are in the timeout handler > > Signed-off-by: Christoph Hellwig > --- > block/blk-mq.c | 4 ++++ > include/linux/blkdev.h | 2 ++ > 2 files changed, 6 insertions(+) > > diff --git a/block/blk-mq.c b/block/blk-mq.c > index e9da5e6a8526..8a2895fed078 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -770,6 +770,7 @@ EXPORT_SYMBOL(blk_mq_tag_to_rq); > > static void blk_mq_rq_timed_out(struct request *req, bool reserved) > { > + req->rq_flags |= RQF_TIMED_OUT; > if (req->q->mq_ops->timeout) { > enum blk_eh_timer_return ret; > > @@ -779,6 +780,7 @@ static void blk_mq_rq_timed_out(struct request *req, bool reserved) > WARN_ON_ONCE(ret != BLK_EH_RESET_TIMER); > } > > + req->rq_flags &= ~RQF_TIMED_OUT; > blk_add_timer(req); > } > > @@ -788,6 +790,8 @@ static bool blk_mq_req_expired(struct request *rq, unsigned long *next) > > if (blk_mq_rq_state(rq) != MQ_RQ_IN_FLIGHT) > return false; > + if (rq->rq_flags & RQF_TIMED_OUT) > + return false; > > deadline = blk_rq_deadline(rq); > if (time_after_eq(jiffies, deadline)) > diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h > index bca3a92eb55f..fa6f11751430 100644 > --- a/include/linux/blkdev.h > +++ b/include/linux/blkdev.h > @@ -127,6 +127,8 @@ typedef __u32 __bitwise req_flags_t; > #define RQF_ZONE_WRITE_LOCKED ((__force req_flags_t)(1 << 19)) > /* already slept for hybrid poll */ > #define RQF_MQ_POLL_SLEPT ((__force req_flags_t)(1 << 20)) > +/* ->timeout has been called, don't expire again */ > +#define RQF_TIMED_OUT ((__force req_flags_t)(1 << 21)) > > /* flags that prevent us from merging requests: */ > #define RQF_NOMERGE_FLAGS \ >