Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp771546imm; Wed, 20 Jun 2018 06:24:44 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJcsKTU2qTbAVpSqQRcrP2o3JSkZZQd0nsUR3IUCjwIhlB2gwxZ5Tq0rVAVuzUJdCRT3P8h X-Received: by 2002:a17:902:42a3:: with SMTP id h32-v6mr23506763pld.72.1529501084788; Wed, 20 Jun 2018 06:24:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529501084; cv=none; d=google.com; s=arc-20160816; b=vpicbSD0byuDFpB4ljUYfoZh98YOfrKUFQxbIeEoC7CF+lROT7CZIqe06b0HKvTyHO 3Sanfp/tTrzegz2cjeKzsJT2UHnvJptDm8Q/YMIMQuRCixlV+kr959zq8R5kKPGbnRXP gM68+ekUwXzI5vsDIeW5oTwuTn2PeKoMMqbaRBzbE1J8awWK8kBCRcoY7Yy5EFKE/wcs vtxMbYWougYbbuJsjv/xVygN5+0Nu2zgG5+3aDl9qCR/GVAQPKnpiu8xaZSPBp3435FN JKbbuJ/K6zuZeCt0kR9RHwcIe3dohor+rSbtM4JiON+Tbw06oJr0yk3gbqrbixmqppbj B31Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=E6Ex6l7W5KSwQZk37j/4OkLvZY5+Z2MBczXe9EUbs+I=; b=jStMUB9rvKNrtZSguJdpJtTyDp5t4yTYN3VjyTaliD8xpXmxUK9Yy2P0zhuRbA2yX3 t4lIaWkIDxecx91IVXg1NfYyTIn8doTAGNGX4tY8NqGNRSQbfzrc1Mhp8qfQpfr918cP 7OymWyTJFbKo0VHVYhpBmZ6uCn6cAhuHHCzYz2LminKkp0iDtlJTAMHNKGBsP1cMpn6a wJsu0yobkoBwxqv9ZDPchhG28JlZkCMuA2FW7kfkH/fSYEmrK6/9rJ/kFL0GAc4R3q/w 3b6YTD/yPU1TmIKncpDPc6O+dFM+8Uv0a+rZcD7Zt056xxbUMpESMVrT4SucPIE0khFc 1Csw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=eviaLpmr; 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 a12-v6si2326231plp.225.2018.06.20.06.24.31; Wed, 20 Jun 2018 06:24:44 -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=eviaLpmr; 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 S1754077AbeFTNWP (ORCPT + 99 others); Wed, 20 Jun 2018 09:22:15 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:38018 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751340AbeFTNWJ (ORCPT ); Wed, 20 Jun 2018 09:22:09 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5KDEbMB172287; Wed, 20 Jun 2018 13:22:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2017-10-26; bh=E6Ex6l7W5KSwQZk37j/4OkLvZY5+Z2MBczXe9EUbs+I=; b=eviaLpmrjQ6FeZadTyQdEZX/nXjhCwNXMJD/ZzNV/x1ZvCRKxeRdAbmK13ITK5svto8s SaI62KdaKghFCrwaLHGnYTfGYN2Y0Of+P8ZA5l9A4++w66l/FUfV+xsZ85j845NvoUoP /ayHu3HlPKsesxqOIT7vxw1oibGq86bFna+bp8MXGZ6Rnbh+mCV2ZcSyZyL5aVuGdWsA K01VY+aGSVDOXQvQ0C4ivjeSdXHbko/7+TI0TIGOq5FHvfmCDn8CuX+DhNuXZnApAGnr KqbpLMTqg60h8eWt5MrYc8SlzAxIBbxlD1o6Ptc6r7xpVuRf4rC+glhdI3jOjdeLFQMh 3g== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2jmr2mmkaf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jun 2018 13:22:01 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5KDM1Kr031749 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jun 2018 13:22:01 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w5KDM1Q9023890; Wed, 20 Jun 2018 13:22:01 GMT Received: from will-ThinkCentre-M910s.cn.oracle.com (/10.182.70.254) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 20 Jun 2018 06:22:00 -0700 From: Jianchao Wang To: axboe@kernel.dk, hch@lst.de, martin.petersen@oracle.com, keith.busch@intel.com, josef@toxicpanda.com, ulf.hansson@linaro.org Cc: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/5]stop normal completion path entering a timeout req Date: Wed, 20 Jun 2018 21:22:39 +0800 Message-Id: <1529500964-28429-1-git-send-email-jianchao.w.wang@oracle.com> X-Mailer: git-send-email 2.7.4 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8929 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=269 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806200150 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear all scsi timeout and error handler are based on an assumption that normal completion mustn't do anything on an timeout request. After 12f5b931 (blk-mq: Remove generation seqeunce), we lost this. __blk_mq_complete request could ensure a request won't be completed twice, but it can still complete a timeout request. scsi (even other drivers) have been working on this assumption for many years, it is dangerous to discard it suddenly. This patch set is to regain this. 1st patch - introduce blk_mq_mark_rq_complete in blk_mq_check_expired and blk_mq_complete_request to avoid the race between them. - blk_mq_complete_request cannot complete a timeout request anymore, so have to export __blk_mq_complete_request for LLDD timeout path 2nd ~ 5th patches replace the blk_mq_complete_request to __blk_mq_complete_request. Jianchao Wang(5) blk-mq: prevent normal completion from entering a timeout request nbd: use __blk_mq_complete_request in timeout path null_blk: use __blk_mq_complete_request in timeout path mmc: use __blk_mq_complete_request in timeout path nvme: use __blk_mq_complete_request in timeout path block/blk-mq.c | 22 +++++++++++++++------- drivers/block/nbd.c | 2 +- drivers/block/null_blk.c | 2 +- drivers/mmc/core/queue.c | 2 +- drivers/nvme/host/pci.c | 8 ++++++++ drivers/nvme/host/rdma.c | 1 + drivers/nvme/target/loop.c | 1 + include/linux/blk-mq.h | 1 + include/linux/blkdev.h | 6 ++++++ Thanks Jianchao