Received: by 10.213.65.68 with SMTP id h4csp2856834imn; Mon, 2 Apr 2018 15:37:25 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/f5cmGz/GtN602Wktzvk56rRgdjkR8GmUvsKFABVuzvwPYIVzJFQKmZ5c5icq6J3HWN7Zz X-Received: by 10.98.87.151 with SMTP id i23mr8562340pfj.175.1522708644958; Mon, 02 Apr 2018 15:37:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522708644; cv=none; d=google.com; s=arc-20160816; b=IGBFqiNCNiBMNuCZjtfAhuamwM03ibWuDJRsVbSgqWz/e9FyMm5g3zVtMLPvUo8MxT XPvu2FQtf9k360ikFNt772PNGPfkajoASMc4qcBGvldQLvkg+V9/mhask81dF0XXO2Ue p2Bx3XPKFAdHFwCfzjOghZLAldVPvNbBVvUvgGmH3O+nzygOEMQLiWpNm0/+XBCQPn6R NZaI5UowSeUL/t+IY/prTrHcbkLHe42XGZDikEDin+dCwS5dqbLhrbn2TIyIpHB9da2Z tpYrQNUgvbE5q3z+OvjYEXUJrD/b4SM9ko+kKIYlZeMZm7hVUyr6QdFN+CuFqZZZ2fsQ Vf8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=mAOVFmPB+91RuNHqkKNv4/uWMpcKBWWpS9Uc447aTjw=; b=HovGRPoqXWL7UoxWJVkdZuZkmQlcpO8a14Uz/2qErOrdNmAnBTsuxWMVk79AJm2n6M h/5AZEL+riigVDqKs5IxQc7op1MtUFK+YVB8kfvvDdfYfx2iFFbmkUikhqW1EE+C0nWB zDoqcxNj47epxrWVsckVykpQO07Ej816IW759PigpAE8PAT/lr4XFge6bTl2YNnrs8aU gc74QwrkOiqnEMVHFIeyhUE/fZuC3aBoTVTB94ArN1VZbIFxJB48Faw+u6DmfM6NBLu9 1gTO77V2d8pw/Fu0CrsQmA1hhKJooVy48HLYWdcGKEEMfwWUmISmAtn77Sj73CXsrK6d haEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=m8pfzXvq; 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 3-v6si1260770plm.735.2018.04.02.15.37.10; Mon, 02 Apr 2018 15:37:24 -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; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=m8pfzXvq; 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 S1754586AbeDBWgE (ORCPT + 99 others); Mon, 2 Apr 2018 18:36:04 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:44541 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754526AbeDBWgC (ORCPT ); Mon, 2 Apr 2018 18:36:02 -0400 Received: by mail-pl0-f67.google.com with SMTP id b6-v6so4105801pla.11 for ; Mon, 02 Apr 2018 15:36:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=mAOVFmPB+91RuNHqkKNv4/uWMpcKBWWpS9Uc447aTjw=; b=m8pfzXvqyRdH6bB7Ro62zIRKcEk1xnwiQE+SuiZvm/4sjKnMUE0YsJ7WqPgAIWYGVK 4Z1tEUoWj0ZtS8e8fVYHIITgfuT10U//TocO8xBni1zM7iwPbW4VBAVaC+uObLU1k94h VzLdxahcBGBOTePVqfCw1YxevXxZ8SVJW68m7qI55qID7tuGp/dr1CPvyw8n9LVezrun mO/uNmJ7AmHk0fyuJUyH0Cimy291Dze0hqZ/F+2ETnrev0/hbfj6ArsZeYvW+ysKNwNG sV6ju0PoV/KrmU/iMj11a82OlLJN7ZdN9VYPuhI7/47Fj653XtFgVfsD74yAKnKEYQ4p e0ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=mAOVFmPB+91RuNHqkKNv4/uWMpcKBWWpS9Uc447aTjw=; b=hJ6Fx/mEDfH43Q2B4MAdlbB3lagKJPRTZ/FPl7WsqjZXGkgUe4S4CJ/mLsEYk9WwBk ODFbchaLQV38o0VucCrQCThT3vlRjmpC2kXixWL3CTSD+AX/U68bbtYDNxj4ACJv4vAG B8UQz/2yNN281jatZuOCAmDUZ0bSPWLV70Z92j8oerZ/EXxbCnp4xBLhcg6h7gKnvALW TplYyQIZTOdEH81aZBXZBw6DxjkEwPHxUZ2GLvUakfDfd2TwuUiYC/ARICHaOva6kRZy HvQ3ff3G8qyNT58nCEgP0ImBJ6ho3Rp/FQBvhXcspdtesv6Zry7fHyA+RtlR9nCWJM+j KPwA== X-Gm-Message-State: AElRT7G2Iel7u5pY/ihFQ5cVTczo754bDPpHJWmqFV67Sq2xtQqfbowr 5Wq+FNcigBt+sTfxOYbGeLCg1LDz0hg= X-Received: by 2002:a17:902:41:: with SMTP id 59-v6mr11693874pla.248.1522708561732; Mon, 02 Apr 2018 15:36:01 -0700 (PDT) Received: from ?IPv6:2620:10d:c081:1130::1151? ([2620:10d:c090:180::1:901d]) by smtp.gmail.com with ESMTPSA id r8sm2307333pgn.19.2018.04.02.15.35.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Apr 2018 15:36:00 -0700 (PDT) Subject: Re: [PATCH] blk-mq: Directly schedule q->timeout_work when aborting a request To: Tejun Heo , Sitsofe Wheeler Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Stefan Haberland , Jan Hoeppner , Bart Van Assche References: <20180402202951.GE388343@devbig577.frc2.facebook.com> <20180402220458.GJ388343@devbig577.frc2.facebook.com> From: Jens Axboe Message-ID: <47e8098e-478e-542c-d447-8b8d03bda562@kernel.dk> Date: Mon, 2 Apr 2018 16:35:58 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <20180402220458.GJ388343@devbig577.frc2.facebook.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/2/18 4:04 PM, Tejun Heo wrote: > Request abortion is performed by overriding deadline to now and > scheduling timeout handling immediately. For the latter part, the > code was using mod_timer(timeout, 0) which can't guarantee that the > timer runs afterwards. Let's schedule the underlying work item > directly instead. > > This fixes the hangs during probing reported by Sitsofe but it isn't > yet clear to me how the failure can happen reliably if it's just the > above described race condition. > > Signed-off-by: Tejun Heo > Reported-by: Sitsofe Wheeler > Reported-by: Meelis Roos > Fixes: 358f70da49d7 ("blk-mq: make blk_abort_request() trigger timeout path") > Cc: stable@vger.kernel.org # v4.16 > Link: http://lkml.kernel.org/r/CALjAwxh-PVYFnYFCJpGOja+m5SzZ8Sa4J7ohxdK=r8NyOF-EMA@mail.gmail.com > Link: http://lkml.kernel.org/r/alpine.LRH.2.21.1802261049140.4893@math.ut.ee > --- > Hello, > > I don't have the full explanation yet but here's a preliminary patch. > > Thanks. > > block/blk-timeout.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/block/blk-timeout.c b/block/blk-timeout.c > index a05e367..f0e6e41 100644 > --- a/block/blk-timeout.c > +++ b/block/blk-timeout.c > @@ -165,7 +165,7 @@ void blk_abort_request(struct request *req) > * No need for fancy synchronizations. > */ > blk_rq_set_deadline(req, jiffies); > - mod_timer(&req->q->timeout, 0); > + kblockd_schedule_work(&req->q->timeout_work); > } else { > if (blk_mark_rq_complete(req)) > return; In any case, it's cleaner than relying on mod_timer(.., 0). If that doesn't guarantee that the timer runs again, I can see how a race with the running timer could prevent us from seeing the timeout after an abort. I'll apply this, thanks. -- Jens Axboe