Received: by 10.213.65.68 with SMTP id h4csp2833027imn; Mon, 2 Apr 2018 15:06:52 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+BisH+Jsz3dQXI524oxTn/gG3lCZqOiCRd3cUqNavycW1/Raljogv9Dw3sgcdEoJRe+Y0b X-Received: by 2002:a17:902:8d84:: with SMTP id v4-v6mr11213709plo.215.1522706812870; Mon, 02 Apr 2018 15:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522706812; cv=none; d=google.com; s=arc-20160816; b=GfVjGyi/zAho+x1ADbAguUSsKkkZ+yB6zenSVBJHRJg0hWx6tmmN+38lZiyR+PBGAX Dd+Sjf3vedQwpAeNvEHDqv6C3Z8yknkl8Pvod7GnJQTeRhZz+3BgahBBukUpA6Sih09C xoqrwZNPzbUAIA7XM6Ar2/2c0ZfPorInlcVAqpsDDIWHtLT0MJ34OTGHe24OqwzVy9Iq 1Td9Bm/DAh1boRq7wiKlgFbLkQmD3RirrThOtQV1EmxPbcf+xvvz46gteSks3uLOwZ3y nosxwRH8fpodc3hE9B5/eOrMfWiBoP+K74c4cflTzJy+AELUxdpWtU3FnmNgmItVq5xu 0Kxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=rJDRbeg2sSNMCnRH4JiImrcoR9XZ0YOArJrm/vHcnSg=; b=I6LMdukhwF3DD5eJFE99e7tpCe6f9xGjdHDDD/cNpSzYIr7la+nVRz1gJopbcTM/9s KgjBOsR253gdGJ3xrtY6MOkbaXlzbV8ajvmNpefDxAIrfjinHF+hyAevgB253T7AtP4k CJrNn/G1eEZ0IIO2Es9XB/BuOnECrSHoHO1HQvNya9H3WY8zuhwCB6h4hjjFpCguk1/U v8KG7wwmcSRTR/5f9oRd4pBucoyTb5WF9uvAbYuhuDqROjUvcYmtb3pC4iOcf5r8gY6+ 7MU9CnbWfGfGfDONkGQJXakiTmfvWbxHlwkHg4cKT1RqaDHKMlcB/uxOciDRlfbZMj2e FSHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=e2B8X+Ym; 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 n2si827783pgq.489.2018.04.02.15.06.38; Mon, 02 Apr 2018 15:06:52 -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=fail header.i=@gmail.com header.s=20161025 header.b=e2B8X+Ym; 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 S1754554AbeDBWFD (ORCPT + 99 others); Mon, 2 Apr 2018 18:05:03 -0400 Received: from mail-yw0-f194.google.com ([209.85.161.194]:37794 "EHLO mail-yw0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754429AbeDBWFB (ORCPT ); Mon, 2 Apr 2018 18:05:01 -0400 Received: by mail-yw0-f194.google.com with SMTP id y23so5477049ywy.4; Mon, 02 Apr 2018 15:05:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=rJDRbeg2sSNMCnRH4JiImrcoR9XZ0YOArJrm/vHcnSg=; b=e2B8X+Ym2tWCcCCH5TMLkjAi84J8YHZ2SN3m/Fe7RlxoBadstcXN11VFQBGpErltK1 N/gUizuOYbeXC2a/ao4Q7iYaRrg5OSBoOu44QdCzTgX9YUTHjeSnaXHZSuUe+fXe9KVV KJaNB9SypdLCJih8Kh3zXxup8muDOUpyO9wzLN/3Hjh+AXBH0oHOBExJ4NY4Uifw/E31 RPh2oAI8c8w1AdVPRtcwNvuPGysS7xaZxyR1SD/2azY2bXElC2B9p147TnTwPw4Z182h AUemy1fqDkat7yMm907HU+UB7EaXBCtXsMbV8QFjMowV3jPlbflmtcw62sJ2OfD6FnOh MTPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=rJDRbeg2sSNMCnRH4JiImrcoR9XZ0YOArJrm/vHcnSg=; b=GaHfYvOfpcEFoMQa1OjdrHJdbFfSIiifl6wYng8WVKykO2y4W8NhUZLWmj5/FD893P OLW/++oqzkv4mUn44qOqDNFPQNRsIzQsKKmx43k+TofpMSBQWNs03rgTqh40zY+jV3EA bbab2bhy+mRW2fyORvnRh9b+UHVU9mRRbklnTGdHGCamPCNVWMPqk/pBEQJHtgj/YheW mZGfshplOox5wFhzBn0SG9W9oFjVuVSbpuHIOgEqP4cTd7sbLVigG0RtMUEBJBjScZc9 UMIQSMfCW5kLz/OZLQEGxnBRNobjqQvzGpo+d64Bo1njK7AbXFgz3Z56L+SQWaOgSwkK 3qRg== X-Gm-Message-State: AElRT7HOZDy+OhDWtPqycxyI7ET2LgpQkTNtNOBZ4Bs7BXLzXOj+V3CW g0bNiUU/sWfa6TwYhkjnuc1/ZCjD X-Received: by 10.129.69.31 with SMTP id s31mr6222379ywa.367.1522706701059; Mon, 02 Apr 2018 15:05:01 -0700 (PDT) Received: from localhost ([2620:10d:c091:180::1:23de]) by smtp.gmail.com with ESMTPSA id z76sm608675ywz.49.2018.04.02.15.04.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Apr 2018 15:05:00 -0700 (PDT) Date: Mon, 2 Apr 2018 15:04:58 -0700 From: Tejun Heo To: Sitsofe Wheeler Cc: Jens Axboe , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Stefan Haberland , Jan Hoeppner , Bart Van Assche Subject: [PATCH] blk-mq: Directly schedule q->timeout_work when aborting a request Message-ID: <20180402220458.GJ388343@devbig577.frc2.facebook.com> References: <20180402202951.GE388343@devbig577.frc2.facebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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;