Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935087AbdCVQgS (ORCPT ); Wed, 22 Mar 2017 12:36:18 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:42936 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934789AbdCVQgJ (ORCPT ); Wed, 22 Mar 2017 12:36:09 -0400 Authentication-Results: suse.de; dkim=none (message not signed) header.d=none;suse.de; dmarc=none action=none header.from=fb.com; Subject: Re: [PATCH] blk-mq: don't complete un-started request in timeout handler To: Keith Busch References: <20170322021443.26397-1-tom.leiming@gmail.com> <2bc8118b-4a11-f28e-50eb-22019184756b@fb.com> <20170322155817.GA18960@localhost.localdomain> CC: Ming Lei , , , Christoph Hellwig , "Yi Zhang" , Bart Van Assche , Hannes Reinecke From: Jens Axboe Message-ID: Date: Wed, 22 Mar 2017 12:35:18 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170322155817.GA18960@localhost.localdomain> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [2620:10d:c091:200::3:134e] X-ClientProxiedBy: CY4PR14CA0031.namprd14.prod.outlook.com (10.172.162.145) To MWHPR15MB1199.namprd15.prod.outlook.com (10.175.2.141) X-MS-Office365-Filtering-Correlation-Id: 440cdc7e-2954-48c5-a121-08d4714170ad X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR15MB1199; X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1199;3:luIamt6MUYMGSUWCe2+4Q6QZ+/8S1d+gbKfyo3TgF649Xjx/qvm7cYKR+q3srLn0lk0epT+REFiBxpR9QUVnrdGQqMQcOQWMU0GkLg6uu5PwLZZua4h0X3QSWIyUI+LuQKN4zhQ+x5WGJErr7vNH3Y8wjduKE5t3+xaOaB0yy19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JCHBGtILVHqAIxAoWkjxUCRLUdxQSOIGcznFstGcW6nJctBN/ySQltxDpvSc955Dzq41VV+HGWWbnF49BdRELtEfChT/wDz6J4kB2TL7I+IdOy0tInycarHlTKBpfgoZgQ7Und2dC6eN7UhGMsSBKX+aJVb5uISla8K9gtuDttN/ifm1isMohQD04k7Gf3W/AvNs8/NGzpPAoxm2Vkk0ySE2QkmEXoRJcHKzoJbEEtWjMvRaR9LF3cx3vUjMKIZFh1eu1U3yNFzaffnpy8kyQw/7AERNsbq8VvIC1roXR37bGeTIRP7Lg+gAFMklJ/xJotafIqo6NUf X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123555025)(20161123564025)(20161123558025)(20161123562025)(20161123560025)(6042181)(6072148);SRVR:MWHPR15MB1199;BCL:0;PCL:0;RULEID:;SRVR:MWHPR15MB1199; X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1199;4:W//Fek65+gPnql1Hig9aja7KroKmuvbSxAW4iDbaFQ6lSws24iBwQua07NLWYf2jeNJihlBzx5f09fIvJ7aeiNEyHWP1IzXlt7Zw1WZfcHXfPctDB9or4y0ScZe4aPtqaWaQnKNpOlCUoiIlYe+Xyj/zv0ZbD17cysaQJp1wE/B7wn8t4wG0VeQJDEyxzOxbBKLCZbXMra7t5/sLwHnJ793qRDztKMqkPSbTvhsVGNOixJ4i9PRnc1BgnLTFHDM6o6X2bQ3m6H06yr9eri99Su98Bs7XaMv1VmGvOWMYokJjoCwWHqVnBwp582YO9/66NsCYVtNIh18LAmwonEQmJ8KLbxSPnMXNqMBk3/J7HcywDl4vttE5RplpiGwPu7svEE8g5pzB0itnhD219OyJsftx475i0Be7Fqfj6BShHF6ZF273ERlK97Y0DlxtoYbqbDyjcdiEAAtXc52aUodhlIDEqsp8E0wPdZJPywZ4lXTA8+V9TFgAyonWdS93uc+cONam87cfiQYYyrCq3aWIUTS+yIYZrkmqcNtChxg4DQ/jul0+Qh6Qqhzo27jWAh56aEI5Rhm8XsJI+9MtVNrO3PvyqerfJ6551p2sRfxgRyEZPmHWjHvo1KlbZQItuBkAcasrShY+uUX+EQaZJ3QREqo1RS66z4De6BKVigtJHzc= X-Forefront-PRVS: 02543CD7CD X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(24454002)(377454003)(36756003)(42186005)(110136004)(31696002)(31686004)(5660300001)(4326008)(2906002)(189998001)(6116002)(54356999)(53546009)(7736002)(25786009)(8656002)(50986999)(54906002)(230700001)(76176999)(23746002)(229853002)(6916009)(6486002)(50466002)(38730400002)(53936002)(6246003)(47776003)(305945005)(2950100002)(65806001)(81166006)(8676002)(6666003)(65956001)(4001350100001)(33646002)(86362001);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR15MB1199;H:[IPv6:2620:10d:c0a3:20fb:dcfc:1850:7e45:b9cf];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;MWHPR15MB1199;23:WyEtzS5NfC+G1HGk91KPTrOZfcnQf8yK33Sst?= =?Windows-1252?Q?JcjobdWRE5y88x+4clkp/HOmTNLt5dvDPcu/hdIshOqUijagj571WtkO?= =?Windows-1252?Q?rnKhjaN5zXYZFFQVqzh6y+SVkSVK0k15/WChrJSb3et76V8fJ9AWEj+f?= =?Windows-1252?Q?A7knS0gbsW+xhYjqs+keK+MJdlUxkMGIrGlv6vLoKO3KDNbfYdx8twp0?= =?Windows-1252?Q?9hsfg6ygqBx4q8SHA4dXwvzbA2YxIHgzWS2VRPqoq/+Vo3PhP9OzzY76?= =?Windows-1252?Q?Fwg62Do9FIB1DcU/ErpBQML7oih0lW1i3bg7rkisc4fdhDyV2/Nm4QUs?= =?Windows-1252?Q?0XNvceofiZoKx/jS+Uc346lEpxe3gJNQXD+EAsei7/jikASoK9lbwzus?= =?Windows-1252?Q?Q4+sqZ4CvOzsucEpDZVxmdT0GD5k5Q8eFWs8QzMDT//DVp4yYHwYDNvL?= =?Windows-1252?Q?9RrOefSPqbj6IwTaTYGCoMyG8gwyI91YPdX/VpSjCBjPNLRv6LYZryvy?= =?Windows-1252?Q?BxnStTSUAWTTiVMyPoFePLaEwPIm9zHO9QBTFpO0K57biKs0s+vjcJjP?= =?Windows-1252?Q?9XuDIzAmfMksRxz0Yu5RpilxCxkibAkMBC2AQ9iLIafFlw9GVVGNsmQn?= =?Windows-1252?Q?sbd3ulADALLrqtbE+CbYo+7Ic403Awl2xYIvSIHCdQFSdmY3BCVIEIIc?= =?Windows-1252?Q?Mqqkh2SBp8U8S2uKt0nMZGhkc0IYy8S9D6Z2kpprryXh76ryt6IwGAKE?= =?Windows-1252?Q?CJDlhQnm2NlunoWB1NdefywC+WXeIaqyjqvLqnNVhcgiQfKAW8ln3Aqb?= =?Windows-1252?Q?zl98YjDwNKzn3hzP5B/3q3Y8MlelZZVuW1UhcLBTNwDXpPUV5FuCnSYU?= =?Windows-1252?Q?krnxJ+owTZ2Vxtzy7KlgBbM4gJ9sWiHD9w4388OBqrqf0DnQ8nh3PEx1?= =?Windows-1252?Q?2rU6/l3o7nnPI0CYsP+oAmh6odyB6M8zIzTe3VZCzpfsUt7j+NJfs1sI?= =?Windows-1252?Q?s/aFmqWmHaUKBsPZwess64ntTV+JZ5P1hEpPpOkKPOHRjLnVypPJXBcR?= =?Windows-1252?Q?yv39v2SYg5u7rMtN657YmCvS2Gu2D9eK0X1+GkXOoNxYVsoVnNheG+2B?= =?Windows-1252?Q?P8+sstTkHUwXxn6DoJrOY4=3D?= X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1199;6:kO1OAZIgcPGa7aO0+soHaaoQgSzYIDmpzyv1ZTggAQN3OD5TvQFgpcS7eaOyrNMCa0KQEJJbzqj+fpYGgGbRyZXrw0VxpR/U3/tg0jIUW9IEq1xYp5l8PZ0Ke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Q0y4Xm9hc5yAVd/pp+JbqUog+WzitXj9JgRNChsxxdeUwCj7HPK7/8LN1pP4zY= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2017 16:35:22.8260 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1199 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-03-22_14:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1563 Lines: 38 On 03/22/2017 11:58 AM, Keith Busch wrote: > On Tue, Mar 21, 2017 at 11:03:59PM -0400, Jens Axboe wrote: >> On 03/21/2017 10:14 PM, Ming Lei wrote: >>> When iterating busy requests in timeout handler, >>> if the STARTED flag of one request isn't set, that means >>> the request is being processed in block layer or driver, and >>> isn't submitted to hardware yet. >>> >>> In current implementation of blk_mq_check_expired(), >>> if the request queue becomes dying, un-started requests are >>> handled as being completed/freed immediately. This way is >>> wrong, and can cause rq corruption or double allocation[1][2], >>> when doing I/O and removing&resetting NVMe device at the sametime. >> >> I agree, completing it looks bogus. If the request is in a scheduler or >> on a software queue, this won't end well at all. Looks like it was >> introduced by this patch: >> >> commit eb130dbfc40eabcd4e10797310bda6b9f6dd7e76 >> Author: Keith Busch >> Date: Thu Jan 8 08:59:53 2015 -0700 >> >> blk-mq: End unstarted requests on a dying queue >> >> Before that, we just ignored it. Keith? > > The above was intended for a stopped hctx on a dying queue such that > there's nothing in flight to the driver. Nvme had been relying on this > to end unstarted requests so we may progress when a controller dies. > > We've since obviated the need: we restart the hw queues to flush entered > requests to failure, so we don't need that brokenness. Good, thanks for confirming, Keith. I queued up the patch for 4.11 this morning. -- Jens Axboe