From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934441AbbI1R1Y (ORCPT ); Mon, 28 Sep 2015 13:27:24 -0400 Received: from mail-ig0-f173.google.com ([209.85.213.173]:35442 "EHLO mail-ig0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933540AbbI1R1W (ORCPT ); Mon, 28 Sep 2015 13:27:22 -0400 Subject: Re: [PATCH 1/1] blk-core: fix queue stuck on attempt to submit request from unplug To: Roman Pen References: <1443386699-5049-1-git-send-email-r.peniaev@gmail.com> Cc: linux-kernel@vger.kernel.org From: Jens Axboe Message-ID: <56097878.2030000@kernel.dk> Date: Mon, 28 Sep 2015 11:27:20 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1443386699-5049-1-git-send-email-r.peniaev@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/27/2015 02:44 PM, Roman Pen wrote: > In case of several stacked block devices, which both were inited by > blk_init_queue call, you can catch the queue stuck, if first device > in stack makes bio submit being in a flush of a plug list. > > Let's consider this regular scenario taking readahead into account > (readahead.c:read_pages): > > 1. Start plug > 2. Read pages in loop > 3. Finish plug > > This example generates backtrace as follows: > > 1. blk_start_plug > 2. generic_make_request > q->make_request_fn > [blk_queue_bio] > if (current->plug) > list_add_tail(&req->queuelist, &plug->list); > 3. blk_finish_plug > blk_flush_plug_list > queue_unplugged > __blk_run_queue > XXX_request_fn [some request handler of block device] > generic_make_request > q->make_request_fn > [blk_queue_bio] > if (current->plug) > list_add_tail(&req->queuelist, &plug->list); > > So the problem is, that on step 3. XXX_request_fn makes > another request, which again will be put to plug list, > because plug is till active, thus new request will be > stuck forever in the queue. > > How to fix? > Do flush plug list till it becomes empty. What devices submit IO from request_fn? Seems like something that would be better handled out of a make_request_fn hook for that device, which would also avoid this corner case. -- Jens Axboe