Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751076AbdCOAID (ORCPT ); Tue, 14 Mar 2017 20:08:03 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:5805 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750815AbdCOAIA (ORCPT ); Tue, 14 Mar 2017 20:08:00 -0400 X-IronPort-AV: E=Sophos;i="5.36,166,1486396800"; d="scan'208";a="3243908" Authentication-Results: spf=pass (sender IP is 74.221.232.55) smtp.mailfrom=sandisk.com; gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=bestguesspass action=none header.from=sandisk.com; X-AuditID: ac1c2134-817ff70000005688-57-58c885ca826b From: Bart Van Assche To: "linux-kernel@vger.kernel.org" , "hch@infradead.org" , "linux-block@vger.kernel.org" , "tom.leiming@gmail.com" , "axboe@fb.com" CC: "yizhan@redhat.com" , "stable@vger.kernel.org" Subject: Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout handler Thread-Topic: [PATCH 1/2] blk-mq: don't complete un-started request in timeout handler Thread-Index: AQHSnSAnUMMcOuTcXkSTeZY/NRpsHg== Date: Wed, 15 Mar 2017 00:07:37 +0000 Message-ID: <1489536441.2676.21.camel@sandisk.com> References: <1489064578-17305-1-git-send-email-tom.leiming@gmail.com> <1489064578-17305-3-git-send-email-tom.leiming@gmail.com> In-Reply-To: <1489064578-17305-3-git-send-email-tom.leiming@gmail.com> Accept-Language: en-US, nl-NL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.28.1.254] Content-Type: text/plain; charset="iso-8859-1" Content-ID: <25F5D51E8F55414C8014713BD977C412@sandisk.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsWyRobxn+7Z1hMRBvvnilv833OMzeL0hEVM FntvaVtc3jWHzWLBxkeMFu9/XGe32HLlLpsDu8fE5nfsHjtn3WX32LxCy+P9vqtsHp83yQWw RnHZpKTmZJalFunbJXBlHNjLUXCcs2L9ha3MDYw32bsYOTkkBEwkLr3ZDGRzcQgJLGGSaH/8 mw3COcYoMad9FxNIFZuAkcTsCXtYQBIiAn8ZJSZ332AGSTALJEjc2vuIEcQWFgiXeNV+A8wW EYiQeP/zPyuErSdx/vdpsEEsAqoSXz6/ZQOxeYGGNk5oZ4TY1sQocfUAxCBOATeJ06dmgt3H KCArsXh6CxPEMnGJW0/mM0HcLSCxZM95ZghbVOLl43+sELaCxOcV/9gg6vUkbkydAmVbSWxZ sJ0RwtaWWLbwNTPEEYISJ2c+YZnAKDYLyYpZSNpnIWmfhaR9FpL2BYysqxjFihOTi3PTUwsM TfWKE/NSMouz9ZLzczcxguNU0WQHY8dG90OMAhyMSjy8ER+ORwixJpYVV+YeYpTgYFYS4Y3O OhEhxJuSWFmVWpQfX1Sak1p8iFGag0VJnHep9tQIIYH0xJLU7NTUgtQimCwTB6dUA2PHEzkx l51/JyR+Cq5rf1L+m4fd1G/6jftmfArvykV5Y2oLj2vISdrFfF2/d8X9tGvhc7Nv3l/a+/PF udzjfEwumz4lTBV47inTPN/k5Y35z9tcHjqolZ15clG5Oj64xaftVJ2HuVL8Cl2ptYr3dk71 PcEV4Zi498wzbeWfnHdTH65ct/CmzlElluKMREMt5qLiRADCOABtzwIAAA== X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:74.221.232.55;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(39850400002)(39860400002)(39410400002)(39450400003)(39840400002)(2980300002)(438002)(24454002)(199003)(377424004)(189002)(9170700003)(5660300001)(103116003)(4326008)(106466001)(3846002)(47776003)(2906002)(39060400002)(50986999)(6246003)(189998001)(5250100002)(6116002)(23756003)(38730400002)(305945005)(8676002)(50466002)(2501003)(53936002)(7736002)(81166006)(229853002)(102836003)(54356999)(8936002)(33646002)(36756003)(2900100001)(86362001)(8746002)(54906002)(356003)(2201001)(2950100002)(76176999);DIR:OUT;SFP:1102;SCL:1;SRVR:DM2PR04MB528;H:sacsmgep15.sandisk.com;FPR:;SPF:Pass;MLV:ovrnspm;A:1;MX:1;PTR:InfoDomainNonexistent;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;CO1NAM04FT024;1:XTufNP/B/2XXtSdmIiZbnt5oocVkOUkxZTSXNMek6OgzRf3vGjAVnd7xMjcTjiJoCbwTlfpFHe2Mm/ty5YBwcPHk3RC9OtGnJSWqtIY701DSWtGqJUQUGfxRQEDcopr39uDB+3YzP/8iaIIHaW+RdpNVazPRV3HrEkv58PvBDeNWeaNr1ZTrjWdWFYt+Jp/0V6KOGDLrjcO2gz/FeEbVcrkLNap0JucFSK4v06LT2WHOerpTfWtKzNybZ3FmKvsl7hNuM7LHfMtoXmCHLMUkZC3HutIEljWUzSj059w6X9fzNW0hK2mfXuuM4mZbSIy9+m32XFa1p7NEwZXsd+DBTvBb/BHWHE8aRAhtWlDYpa1qkFCeg/I1KzjKN9oWgIkuOKaRbQNTsfdkYB6TFNQC46xO/eJd1rn4sa/jmnFHX4NZelRKxqWh9ps89b9zsGOrj9NDBlZvc5zufdPpY5Qh1BLJy7/Yc6GhmgieouNhe/Q8cULjI6U9BurhN29UNENFcl5JY3QnYAOYNpAIIa+bW95JGOe01GqqcoKleR8LQumDReP8bOUWKuFrfAzMedMdZtJLAbiKG1rAp16t/Ii+IQ== X-MS-Office365-Filtering-Correlation-Id: d7212e17-2d8e-4aca-d8ae-08d46b374e67 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(8251501002);SRVR:DM2PR04MB528; X-Microsoft-Exchange-Diagnostics: 1;DM2PR04MB528;3:P3LaGF60js6HZGLyfV7wr3QPz0vjJzXTbhoden+Yei5i2TL0JkeUKUtZCTQYGrLdsd4wHERx3xIeNKtLpaIyCOd8i4AhBxjVcfj+Lq56MGgrfc9VW7MIgs05Ho5QdqY6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1TS7sw==;20:PJ1cED44XsZnbwzVtpKNHZC22FlK4zjqrChgzOcyk/dTBokWohot0EIVvQWRKig85K0JU05MkbZYmfu9pFd8FmziAGk+0PMNL5nExV54fJUJgELQWAFWqN3OEgcyijaoyU3OAKKVwgdFt+zPt7jlrGWi4txWyf7t9hRp36JPSYKxHAcQbzGmKlKkN7kQ4IPBReOb2nFTYY02AzjBqHCE4GfIvZspcEXSZt5cIpcLmegBqD27hooRI7BNvL6qdH+SU1iteHC8zKbnrgTZcJ7OOrG8Dwk24D413zorYeG9UaA8c4pWBpFeDbXT1oWnVSPeZLN+g5pkhGQb0kE5AANFdfaNOJoGl+NPQCAAJD0PLCcRCz2nJV90aUq5Q1ZAYgJcYer7lqhevip6QXownNovPfauOZnda3x9H7E7rglSu8iSblw91XymTa+o/DLxqfkyr5KMxgnUV1GuOJRFsG1WGIg6GfEgoq04UC2Iek7GDR2GjuHM/l3lwHaUyRagqS33 WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(13015025)(13017025)(13018025)(13023025)(5005006)(13024025)(8121501046)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123562025)(20161123555025)(20161123564025)(20161123558025)(6072148);SRVR:DM2PR04MB528;BCL:0;PCL:0;RULEID:;SRVR:DM2PR04MB528; X-Microsoft-Exchange-Diagnostics: 1;DM2PR04MB528;4:muMlaKArgqlnf/2EUvnCRgINNK6Raq/siA6m9bx3Gjcoxk+ez7uWvKH3ZeKoeYYaCVtS+reR6XRHOKKugFc/QOb9GLIQDeJNos+aqFfaQSB9BqyIEVPlAHY+JrmNovd09QJtzJpLW72OJ3hMOvxLQLWBfQTnQe2r9QH8P8FaHsV4KAuYQcmq01vGp2Qb0fhjM7B4zpJT2u3JuMQSuk/iqXQ/x9VHlq9AaG/IEO0Q+7VEsvKOat6MGTC7twy19lIfFkCRQlvZXi29ywhhDDQGyoMunH90dslICuHnhDo1+Sh3L5n++nRtH+aSWv6Dgy1LhHyTtea+DO0z2r5iVSKRhjxHcZJnLDkbyRs+qh7BQbSbSiEmXPM2gcV3HOJ2LAixJ2ajFlL0a7mPPgZNr4TKRnc81AXzjCc/TWKjpzQE9JQAcXbX1Dn2oKuZelJ9QCb4ObOjlombt/LctLueP8jFc2x6OSJR/hbwVHqoi4WGTPLWwRUOBH1by8MoVA1WAKzF4axJvkdfF4WPqP9mPWE/adZCnE/YvkMShflRckMLYLluo/8KIRmUgMp744YcO8nQb9dEU80ygOemMXdTczuTYP0v1GbCQ0fedE8wVgXoVD7JCMNzv1ZujD8tvNFBAfY2iiRbo2Y5mVRYXIF6qmK84LmAfEBM+l7fHqh117zpV1Ekj1UxqZeNRm+wes6743SzxDXKIyw/oWwpjYg1n+AnbQ== X-Forefront-PRVS: 02475B2A01 X-Microsoft-Exchange-Diagnostics: =?iso-8859-1?Q?1;DM2PR04MB528;23:5vHRbvMoGQjBPSy+OmUqJQPiXauFDgR67D/T5Izk?= =?iso-8859-1?Q?R5JQBqsh9yFolNPkSWLKVkq18agLDDDS4Agopu+4NtVUdDkemfhCt9/7SY?= =?iso-8859-1?Q?zElFbQkUuFnUbWcj+FxemSZBqTpUTQMETv7bLabsLqQDS2l9fOaXNAaV8f?= =?iso-8859-1?Q?xuV0+uapAZcPDIx/3J7V2uzhMjdCwcdLdzhB3ukg88PHMo58VvDT6iYSld?= =?iso-8859-1?Q?b67NFIUliT+784ja9YgehWOB44U2YZ9c7bBuucbfh6jDPaNxGPWZBdxfuI?= =?iso-8859-1?Q?op4YLXPWl+/YvzlGUW9+wEat1xDunGE9DwsqMTfkivCV/QwUx/qvNLNmrK?= =?iso-8859-1?Q?G87FTje27014djNnTyv5hsRLQN2L66VRmBqjXc/8BOc9a50Dl/3KLZrflf?= =?iso-8859-1?Q?AeDsdn0k6AdE+nRUHE/P994OIy3uy3ffgPjy+GhIbJEk8EEJ2CUsoh96pd?= =?iso-8859-1?Q?WOsIwrRiSH+LOwVP602Ho7TVGF4GMn3KPOGsn3S+95z0r+OUxVdeNW0YqA?= =?iso-8859-1?Q?glybBafJ9EOZDIJofJHMCSITc403MHBR+Tsqf7J3+O18NHB05RgRcFc/sQ?= =?iso-8859-1?Q?M7oV6K3Uy5tF3uothYaC0dVxBvJg3TSC2+FooFqVZmIEyBMPx1KI4DJnyd?= =?iso-8859-1?Q?RLKP3VmPQoTc7XGES+du2SidJr412a2Ov2llFRh0LzAHiGAqEez/Zuqskh?= =?iso-8859-1?Q?/esHtCqnvu4PKGJtxhaAljlpiVhlMjzY+UomHtiLikXs0MBgS8x0KIvg8k?= =?iso-8859-1?Q?wRHc3GUsuFEK3UTn18fnhJwafwkVNWOyxFDvjaN/1UYRK2XkqZolOWzEDj?= =?iso-8859-1?Q?uyOrSdiWGT0qsOwbQa9zcPWUl4+z3gJMt4XuUfPl55DpBuf8++Gu713q9/?= =?iso-8859-1?Q?+8b6xuGlOeZMIqTGZj58t1HkI+PkRPzhVjG/fVF3rOK6Yg8TNd91+ncn/e?= =?iso-8859-1?Q?1qDyhj40Cr6hpLYWnNRbXfl8AJ65h8w7qJYnJMwOTKrFnaRreirN2TDmT8?= =?iso-8859-1?Q?yOmjxxw+Wdfi1yKnJ7NlYkht2jKuakGCn8HAu0MaTLSaJw+sjdSOM4X4TL?= =?iso-8859-1?Q?63SQppFMK9ldxuSqrGu5ghATWhVBI0abS10iOX2d1A28wOh6K9KDhhcLZC?= =?iso-8859-1?Q?qSuKkthoyIyEtbi/1StZvnN8UAdVC1T/ZUyRvb8/hv3MoZdMjycR/wsz80?= =?iso-8859-1?Q?yOJBnfzdWjzVIFCPcwQzRV8EhxBYCB72G+3qnHhLwxe0nQ0GwVajm3Av68?= =?iso-8859-1?Q?oVjqEX1KIV6/kd+n?= X-Microsoft-Exchange-Diagnostics: 1;DM2PR04MB528;6:/jTpu61CvfrEUegztFkkyghcjpu5bSaBlz7uhjizr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iOJocZ8A0UU5YwJzUmdZeRewT3G3HRGA4zExQF0l94zpyLd46SVOJjhVYLq+GeFBFI27exHQlKoGQ72v9cWLITqJWDaJuiVCcyBv++vJ3OqfeFsSeJshQhMvbYXhVWL6ONvtbvKOBaIe0+wBlkgEhl+EE6mYPO/VA= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2017 00:07:44.4353 (UTC) X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=b61c8803-16f3-4c35-9b17-6f65f441df86;Ip=[74.221.232.55];Helo=[sacsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR04MB528 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v2F087wg010454 Content-Length: 1170 Lines: 32 On Thu, 2017-03-09 at 21:02 +0800, Ming Lei wrote: > diff --git a/block/blk-mq.c b/block/blk-mq.c > index 159187a28d66..0aff380099d5 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -697,17 +697,8 @@ static void blk_mq_check_expired(struct blk_mq_hw_ctx *hctx, > { > struct blk_mq_timeout_data *data = priv; > > - if (!test_bit(REQ_ATOM_STARTED, &rq->atomic_flags)) { > - /* > - * If a request wasn't started before the queue was > - * marked dying, kill it here or it'll go unnoticed. > - */ > - if (unlikely(blk_queue_dying(rq->q))) { > - rq->errors = -EIO; > - blk_mq_end_request(rq, rq->errors); > - } > + if (!test_bit(REQ_ATOM_STARTED, &rq->atomic_flags)) > return; > - } > > if (time_after_eq(jiffies, rq->deadline)) { > if (!blk_mark_rq_complete(rq)) Both the old and the new check look racy to me. The REQ_ATOM_STARTED bit can be changed concurrently by blk_mq_start_request(), __blk_mq_finish_request() or __blk_mq_requeue_request(). Another issue with this function is that the request passed to this function can be reinitialized concurrently. Sorry but I'm not sure what the best way is to address these issues. Bart.