Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp808550imm; Mon, 21 May 2018 14:54:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrC0w1wblYKE2HUnjsGFZyV110BQl4EAolTXQISdJ5Q7j8wFMB/NMjD9cmiQZQITKSlINQ7 X-Received: by 2002:a17:902:d909:: with SMTP id c9-v6mr21689645plz.293.1526939662750; Mon, 21 May 2018 14:54:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526939662; cv=none; d=google.com; s=arc-20160816; b=Is2MhPuVALsnUFgsb2CCUpFa5cMf86IgEwKuZlq2faDxeIMasdVz6vJ+HDiGx5Zn5F Igjb1LxThPjrIwao08xp+OvASmqoB5K0XTGBqw3vPN8ZNFiD/NTwR6WAWuJK2cbZQBI5 Pu+zFhsV/v+tQ6TQIk9dojsweoyLJMi35PEQK3edUOrPv8P4X6ToeOPb5oKBrXr/G9tQ 3gbaCO38+eV5Y0kZOid4u6yhXIc43rRdaGHjufX4VN/hVNvtSeQl2vPkYujTxKhlpzX9 yhaQH/2vmvxLLwygBuXSEgakOJNgPBV3HhgVBYSC1mN0dGXHS8siK40Ji8teozZMwTg7 nA3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:date:message-id:in-reply-to :references:from:subject:cc:to:arc-authentication-results; bh=5Pu3Iv1A3gFslmCabmEjdJkEiVxVtV5d3INjtZCSE0I=; b=GjLzq0yrp6oNrk4aUYgMMwhG7+FWfT4FRejJSlaWSM/p5Ycr3oomY3rmSmkzwFr+Rs lwQLWxG8PpEAOC7rNRP9ZGAyJF2Zr0bN9n7d5lEZWcc79zp1Qcx2FPwhYXB9XMVENffp 8HWDldfIM4FsCsnnLZbCcBw6CmGJcLyxR0t1MUgilN3Cac843g8KtapIzfKEFJUoddDC xHQHNGzDOrMspmOPI+uXZKH2ChVZ8uUI0LObXIkqYvX3AltSJA7vLMVckLGUBlNUHaTc GrdorCfAZTW8d1DN+ZNBKCr1ENbgunSOa1k497e/So01t5VCbup7aO5bcJu49QMSyRT/ hsHQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t71-v6si11899683pgd.7.2018.05.21.14.54.08; Mon, 21 May 2018 14:54:22 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932162AbeEUVx7 (ORCPT + 99 others); Mon, 21 May 2018 17:53:59 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:36953 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751137AbeEUVx4 (ORCPT ); Mon, 21 May 2018 17:53:56 -0400 Received: from fsav302.sakura.ne.jp (fsav302.sakura.ne.jp [153.120.85.133]) by www262.sakura.ne.jp (8.14.5/8.14.5) with ESMTP id w4LLqORU026110; Tue, 22 May 2018 06:52:24 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav302.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav302.sakura.ne.jp); Tue, 22 May 2018 06:52:24 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav302.sakura.ne.jp) Received: from AQUA (softbank126074194044.bbtec.net [126.74.194.44]) (authenticated bits=0) by www262.sakura.ne.jp (8.14.5/8.14.5) with ESMTP id w4LLqOfw026106; Tue, 22 May 2018 06:52:24 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) To: Bart.VanAssche@wdc.com, dvyukov@google.com Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, jthumshirn@suse.de, alan.christopher.jenkins@gmail.com, syzbot+c4f9cebf9d651f6e54de@syzkaller.appspotmail.com, martin.petersen@oracle.com, axboe@kernel.dk, dan.j.williams@intel.com, hch@lst.de, oleksandr@natalenko.name, ming.lei@redhat.com, martin@lichtvoll.de, hare@suse.com, syzkaller-bugs@googlegroups.com, ross.zwisler@linux.intel.com, keith.busch@intel.com, linux-ext4@vger.kernel.org Subject: Re: INFO: task hung in blk_queue_enter From: Tetsuo Handa References: <343bbbf6-64eb-879e-d19e-96aebb037d47@I-love.SAKURA.ne.jp> <43327033306c3dd2f7c3717d64ce22415b6f3451.camel@wdc.com> <6db16aa3a7c56b6dcca2d10b4e100a780c740081.camel@wdc.com> In-Reply-To: <6db16aa3a7c56b6dcca2d10b4e100a780c740081.camel@wdc.com> Message-Id: <201805220652.BFH82351.SMQFFOJOtFOVLH@I-love.SAKURA.ne.jp> X-Mailer: Winbiff [Version 2.51 PL2] X-Accept-Language: ja,en,zh Date: Tue, 22 May 2018 06:52:21 +0900 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Bart Van Assche wrote: > On Wed, 2018-05-16 at 17:16 +0200, Dmitry Vyukov wrote: > > On Wed, May 16, 2018 at 4:56 PM, Bart Van Assche wrote: > > > On Wed, 2018-05-16 at 22:05 +0900, Tetsuo Handa wrote: > > > > diff --git a/block/blk-core.c b/block/blk-core.c > > > > index 85909b4..59e2496 100644 > > > > --- a/block/blk-core.c > > > > +++ b/block/blk-core.c > > > > @@ -951,10 +951,10 @@ int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags) > > > > smp_rmb(); > > > > > > > > wait_event(q->mq_freeze_wq, > > > > - (atomic_read(&q->mq_freeze_depth) == 0 && > > > > - (preempt || !blk_queue_preempt_only(q))) || > > > > + atomic_read(&q->mq_freeze_depth) || > > > > + (preempt || !blk_queue_preempt_only(q)) || > > > > blk_queue_dying(q)); > > > > - if (blk_queue_dying(q)) > > > > + if (atomic_read(&q->mq_freeze_depth) || blk_queue_dying(q)) > > > > return -ENODEV; > > > > } > > > > } > > > > > > That change looks wrong to me. > > > > Hi Bart, > > > > Why does it look wrong to you? > > Because that change conflicts with the purpose of queue freezing and also because > that change would inject I/O errors in code paths that shouldn't inject I/O errors. But waiting there until atomic_read(&q->mq_freeze_depth) becomes 0 is causing deadlock. wait_event() never returns is a bug. I think we should not wait for q->mq_freeze_depth.