Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753921AbdCOPhC (ORCPT ); Wed, 15 Mar 2017 11:37:02 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:25996 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753144AbdCOPgq (ORCPT ); Wed, 15 Mar 2017 11:36:46 -0400 X-IronPort-AV: E=Sophos;i="5.36,169,1486396800"; d="scan'208";a="3501251" Authentication-Results: spf=pass (sender IP is 74.221.232.55) smtp.mailfrom=sandisk.com; infradead.org; dkim=none (message not signed) header.d=none;infradead.org; dmarc=bestguesspass action=none header.from=sandisk.com; X-AuditID: ac1c2134-82bff70000005688-38-58c95f80894e From: Bart Van Assche To: "tom.leiming@gmail.com" CC: "linux-kernel@vger.kernel.org" , "hch@infradead.org" , "linux-block@vger.kernel.org" , "yizhan@redhat.com" , "axboe@fb.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: AQHSnaHrU37A+4KiG0iRVrsVYNkGIw== Date: Wed, 15 Mar 2017 15:36:31 +0000 Message-ID: <1489592177.2660.1.camel@sandisk.com> References: <1489064578-17305-1-git-send-email-tom.leiming@gmail.com> <1489064578-17305-3-git-send-email-tom.leiming@gmail.com> <1489536441.2676.21.camel@sandisk.com> <20170315121851.GA15807@ming.t460p> <20170315124024.GA16549@ming.t460p> In-Reply-To: <20170315124024.GA16549@ming.t460p> 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: <4696CB351FC7834398D4BFD1D62C3773@sandisk.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRmVeSWpSXmKPExsWyRobxn25z/MkIg73PxS3+7znGZnF6wiIm i723tC0u75rDZrFg4yNGi/c/rrNbbLlyl82B3WNi8zt2j52z7rJ7bF6h5fF+31U2j8+b5AJY o7hsUlJzMstSi/TtErgy3n+5zlTwgKPi5/Gl7A2MrexdjJwcEgImEufnPgSyuTiEBJYwSfxe NpkJwrnEKLHg5lNGkCo2ASOJ2RP2sIDYIgLGEp9eP2MEKWIWWMUkceN3IytIQlggXOJV+w1G iKIIifc//7NC2HoSp5/PBWtmEVCVaFy0Cmw1r4ChxNJ/79kgtn1nlPh05ToTSIJTwEDixZJb YM2MArISi6e3gMWZBcQlbj2ZzwRxt4DEkj3nmSFsUYmXj/+xQtgKEp9X/GODqNeTuDF1CpRt JfFxaz87hK0tsWzha2aIIwQlTs58wjKBUWwWkhWzkLTPQtI+C0n7LCTtCxhZVzGKFScmF+em pxYYmuoVJ+alZBZn6yXn525iBEeqoskOxo6N7ocYBTgYlXh4X/ifjBBiTSwrrsw9xCjBwawk wssRBxTiTUmsrEotyo8vKs1JLT7EKM3BoiTOu1R7aoSQQHpiSWp2ampBahFMlomDU6qBsUzz 0u7+/Uahl+W4qk/xv5AXPvMy7/Fd4VMa89ddjr0VbGFl9VF1zWWro8wl7HNf2+yum6j6nHf6 M3kuQ53u6x8udKicmrDLmo1/yRvx7TrS2zlNVsSkPeRYs9KpY6kU7869wusahJ0WPL47oeLj 3cgXbYLf8j7an3eO91cLyGLIPrrz/2TheUosxRmJhlrMRcWJAMHG7a7QAgAA 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)(979002)(6009001)(39450400003)(39840400002)(39860400002)(39850400002)(39410400002)(2980300002)(438002)(199003)(24454002)(377424004)(189002)(9170700003)(7736002)(189998001)(4326008)(81166006)(8746002)(8676002)(8936002)(6116002)(6916009)(3846002)(2950100002)(36756003)(102836003)(23756003)(54906002)(33646002)(2900100001)(6246003)(2906002)(38730400002)(110136004)(103116003)(76176999)(50986999)(54356999)(5640700003)(106466001)(50466002)(5660300001)(305945005)(2351001)(39060400002)(47776003)(2501003)(86362001)(356003)(229853002)(53936002)(93886004)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR0401MB1491;H:sacsmgep15.sandisk.com;FPR:;SPF:Pass;MLV:ovrnspm;A:1;MX:1;PTR:InfoDomainNonexistent;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;CO1NAM04FT032;1:zB7bT09w8YbEG2KRjJ6jAfqdH2I6+8StwMVuEcMGDBGuHhUoM4CJSnI5J6PEdcsgkR/Rq25s5E40IyohYOnKR7sQuAtNhkeFdEwVGKD6bncflhZ/6oVyyJwok2NXI1qY4sfiN1dAtFsYCZMq+W0Kwq4LRsI79r32K13q1ZuRQD8JXpfD0tt6yvtMG++dw2nH9GwjJCOCT78h0i7oV/05vSZka3qMgxJ0hXpFf9qX1lCVa/aEFwKubdADIE90YK48d2Si9PnVIILD46zAYMBdERhqLOGZKeodKL1mB0KyVRugX/1YUw5Jgi/q/nDsgbcBPE/KA9AN0kQZrs4NHPvye5sSYtg8gn1yimlhlfRSujoRQYSue9vdiLeaidjzo8eGuXXXzREE2VzwUBbrOGh0I8rpKiCnG8wC5JFBdFnM6zQtPmOgSS/oacF/8H5rIZXyPdaNcJk3OBwTxZLf8kSq+KZ/626NiqJl/cGNsY3/uYHqmIjKwVBE6DmsiqFf9Bin3ePwpG0CIP5lqUwUKHuTb8WSFHaLzU+7y/8DtPG+etg6CQxc/bYl0gHdtdNTBRdL4QhrcWvj3IdsF1kEluI7fw== X-MS-Office365-Filtering-Correlation-Id: a7cad2ea-197a-4b46-07dc-08d46bb912c8 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(8251501002);SRVR:BLUPR0401MB1491; X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1491;3:rwhwgXHQ7oDtF9EYKIjxKvIPS+yTmL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yEaFgYum8CKdzcKruMHDioZZI8UNIdwBtbtukHYmJVyjBKvX;20:AhFYLRTrl0oBhWfvhJe0IjXRSaceaNqFFnQXNCrLzZthK/SvLs6BED60WfE2VKE/NcgUBZ3fJI3m7hYZELrCc/H4D20ipvhSlj6B1+O7AasZk0ka2w+JyiomCl6yk2zbl+6/KaseYi38ylJtzsbGFBd3vkyQxQQcaSFkPayy0r3sxnSWNOC+0zVLkh/4B6uI1P2cykdxstVYe182ySLV4FLZueuBj7T4ohdMQfZx9IhW0I2RNTxWPCTFW7qRCANRAAtiI1K3rse8I0VZpXTA9id46pwjDBTSen3LHamjcj+Hw1re4uHUzDGuI7fLngLswVR4605vOrUgYtILaxkp9xTCPMdjVwwUTOq73iz9HESk9IU+FnKxFfIk/xt7O5ysr2y72Wo5CnOia9UrtKzLXdPxAqiMGKmk0LAli7ydg7T8ymoAv1Xe49E60w7G6q3I00sHrcp6JZJdzBzrrPCeOSRZpSSfRaWj+QIWF73TWk6CoHX8OHU2QweoZGZdg+E9 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)(13024025)(5005006)(13017025)(13015025)(8121501046)(13023025)(13018025)(3002001)(10201501046)(6055026)(6041248)(20161123564025)(20161123555025)(20161123560025)(20161123558025)(20161123562025)(6072148);SRVR:BLUPR0401MB1491;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0401MB1491; X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1491;4:qHFsIVVPzr5n/MXHvz+DjKk6abJSN6ihHh0ldEUM6oCcp/6T6Y6MwL4LV87lNAw2HU5XJ/nJIyiHM6Oui/0q2Ex0GK8Y1F1SGQ6+a6Myju3zJnbTwnYrHoCYIiQQOGnCWMXTPiYsk+NuCd5EUjyFJbkrg0ynu50g8Nm1dtDH6Yfb21OpIQ58QE96DPq66J4EZEgL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ru2hbbLj6DjHMOoDFlhGN/t2bJw1Xziha51V?= =?iso-8859-1?Q?u1KW2/skFFi5ltMyq17FBB5Dlu0NWSDHOmHK41NB874F7Zrs6TVUy/TUNJ?= =?iso-8859-1?Q?UF5nRNrLEvarAaJhBKu1ctnvhww5S1HReRvqYIDwWFJBsFajvTiRg=3D?= =?iso-8859-1?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1491;6:TvTQuthv3jOMxx0kuAohrznG8HURkQ5kXhnIcps1t6NFS0CHcYdudPAsxDJrQyDEv3XDKxEj+JnBmRwXL4b6hbREleUDjuAS+qXzEP4ag40xBhuCN8pMj+us3afKlLoSgh2j9eCdTRUfAgqSb6JPDyMVC7up4uETYYLe3S2UdtiIhMMvqqOhopTmlWhM9fuP0OIojgJxlznMqOMezHiWd1IkFsPBMZAjGEVBZv+paBoRkTVDier63Me8/vYXbAxPUGYXWwd5f5HtRFnTha0gemIuzyVsLyYdUspnYapXuLyx2ZvklqXGkRn4UV1WkW27UxlaNlpwwqTactTOcNT+oEPOJD4jrW+zhR2OyIgp5wlclxp0Yf1PN01ggxBRGhvFYZ62VWOOKP9OIspXxgt3qQmT5rFK+xONX8XtNhPBr0g=;5:BRS2EeJ0xapixt4jOUCuKWOl4JcaR7icW84/RFQ11bvIGXjFxanjrG5zEkPjn9H9TmXJ/AI+67KYKy6MYzoXBesLK3U4nwwNhYDTwpCeL7co0LKfrNxXQ/7naRskixShdRT5GwoHLY7PE7LVK9tz8w==;24:ElGvjSY561xII/gO4bf07RdZXyLM396FaeTs7231Yxy1pxTrsXY162tU7CM8Z5w6eESGlumixJlHIktKbnCjYJPDomhRXwigsAeeUpJsDA8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1491;7:NjpWSwoR75ZEIyWn+G1KJYQBhYI/6bIFsUqdYMZouye7M80bm1/evfQjCBt24Pk+DDF4Q3l3yBP8rplBvah+l5bdqrOMTGrmGzKl6DRN6WJkHQLhWkI3YFH49SeE8W9QGOtmStr0xv+3CH9Iz9F0vTu++WYIDiyBt/wiYsUL1WUNwUnJ2pw31ghcUttpuVWBIVoCVhnw9iBwqs4eZL6rcKn7i1+HFcOuV8ei1i60CQGKHXfWIQAlnOd7fCUic34+Ydvm2bKZb5IQ1SzGFavh9IdQmIVTRFHLRigtpLGOOTFA7hdqw/G5wGf056mI5XxJjD4reA/nawBPUq/ubXA3bA==;20:vNhJBgDdjG0r7Mf6itNsNwIsLmPy0+bcKDQb95M7y4GfdrdXtLZBbHmZDFdG0XPGqLs3yGMk2FCOLTkCKauAwmTs4PNNZFbSmiSzgrOT6dEnt4b8iRvziHSLp/C1FI4ZURLX12KqoqePnaOMO+dfILrkCH/wLGAQRL7a2ygwt3A= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2017 15:36:38.5242 (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: BLUPR0401MB1491 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 v2FFbe1c031961 Content-Length: 1063 Lines: 28 On Wed, 2017-03-15 at 20:40 +0800, Ming Lei wrote: > On Wed, Mar 15, 2017 at 08:18:53PM +0800, Ming Lei wrote: > > On Wed, Mar 15, 2017 at 12:07:37AM +0000, Bart Van Assche wrote: > > > > > or __blk_mq_requeue_request(). Another issue with this function is that the > > > > __blk_mq_requeue_request() can be run from two pathes: > > > > - dispatch failure, in which case the req/tag isn't released to tag set > > > > - IO completion path, in which COMPLETE flag is cleared before requeue. > > > > so I can't see races with timeout in case of start rq vs. requeue rq. > > Actually rq/tag won't be released to tag set if it will be requeued, so > the timeout race is nothing to do with requeue. Hello Ming, Please have another look at __blk_mq_requeue_request(). In that function the following code occurs: if (test_and_clear_bit(REQ_ATOM_STARTED, &rq->atomic_flags)) { ... } I think the?REQ_ATOM_STARTED check in blk_mq_check_expired() races with the test_and_clear_bit(REQ_ATOM_STARTED, &rq->atomic_flags) call in __blk_mq_requeue_request(). Bart.