Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2473885imj; Mon, 18 Feb 2019 06:38:42 -0800 (PST) X-Google-Smtp-Source: AHgI3IY2vW8xCLhQo60JIo4ELp6LJcBfDsnr8uzOGgdQJYo3ofEBlsaVLdHsmtLptddEvhqpbkKi X-Received: by 2002:a17:902:9a81:: with SMTP id w1mr24881550plp.19.1550500722135; Mon, 18 Feb 2019 06:38:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550500722; cv=none; d=google.com; s=arc-20160816; b=Npe9QAoPi7+AsDZl624EnbAcd+ENdtCuUQCXR898RVaDExmoqd+Pp7TB9pAl19ROZa 41S6TKvXywFWLkZr9TnSUgGcEXtnuoOdgGRO+c5+yAN2ruvIdjF+o1l6owGOovvhvJ8K 6YUf9N5asc+8qjHCeBwl48zuYAsRS2wIgBMv56WJF/AvoZelmoFNy9SPd1qY8ZXPmrOJ qeexncTCbrfmpXcO0wS+SWU5+ohEfATuxEIvZymohDxSPZl1v26BygfTX+9El1MlTbZf 9zDaU8o5bZM9utVncJ1AllecFDQxrxzCzX9Fxm8I1U9UMS7Qu0GcSIexvYTmrfbEwO0l GfOQ== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LpC19VerfA0yrhtfCAOxNfk/XDWf9X0J6HXHO2oG/X4=; b=Kfh/JoCv69TmUYEjp6mQtDXHP9UA4u+K7sxwPGSMclTl8Ar1vvTPaMYFn1YhqZogdg prcBzPyoLIsiBEIIB6SHDqaol1D9x2aLhmLa2wCI/UIDrtsBrZNdRGW61l1iSRCSg6eP qiBXKEA7lYb8jkGcvL4US1i5l+z+sAji0FdcqyjDF0/UVU1nRRDyusHv8YK6z75+4U1/ gAROCoPChl3HpfiWC47Mi6x0jkpxrKRUNyc9RWdNDlyefVADg0AhHG0QuxBguJiMRSRw +ONlbdRtIdR6PcRz0SoVGz+gV7T3hXZpkmTjOmB9ZwdmlXpvT6cFRT4qMt6rA9NoDZn5 xOrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tBRbjKcO; 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 k7si36732plt.198.2019.02.18.06.38.26; Mon, 18 Feb 2019 06:38:42 -0800 (PST) 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.org header.s=default header.b=tBRbjKcO; 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 S2387411AbfBRNy6 (ORCPT + 99 others); Mon, 18 Feb 2019 08:54:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:34900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732824AbfBRNy4 (ORCPT ); Mon, 18 Feb 2019 08:54:56 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3F8672077B; Mon, 18 Feb 2019 13:54:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498095; bh=Ib8hmCYS0aNbwcrtf4Z9gmucXBiAZUGMW079uVnpvK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tBRbjKcOn4/bjjx483D0DZocJE+AxVfhgrHMqC+0GodCkcZVrNDoUPOj4vtqZMFFs 6zJMVCJs/9Ygc1IHW+3xomtGN+67FJKnY72olA9VLxZpioE0cCw7pwLWYl1jf8cJN4 njRT1vU/KL60C+s1fXNSnXpdoU7DKyO0pN6BLMcc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Stecker , Jianchao Wang , Jens Axboe , Sasha Levin Subject: [PATCH 4.14 03/62] blk-mq: fix a hung issue when fsync Date: Mon, 18 Feb 2019 14:43:09 +0100 Message-Id: <20190218133506.074097764@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133505.801423074@linuxfoundation.org> References: <20190218133505.801423074@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 85bd6e61f34dffa8ec2dc75ff3c02ee7b2f1cbce ] Florian reported a io hung issue when fsync(). It should be triggered by following race condition. data + post flush a flush blk_flush_complete_seq case REQ_FSEQ_DATA blk_flush_queue_rq issued to driver blk_mq_dispatch_rq_list try to issue a flush req failed due to NON-NCQ command .queue_rq return BLK_STS_DEV_RESOURCE request completion req->end_io // doesn't check RESTART mq_flush_data_end_io case REQ_FSEQ_POSTFLUSH blk_kick_flush do nothing because previous flush has not been completed blk_mq_run_hw_queue insert rq to hctx->dispatch due to RESTART is still set, do nothing To fix this, replace the blk_mq_run_hw_queue in mq_flush_data_end_io with blk_mq_sched_restart to check and clear the RESTART flag. Fixes: bd166ef1 (blk-mq-sched: add framework for MQ capable IO schedulers) Reported-by: Florian Stecker Tested-by: Florian Stecker Signed-off-by: Jianchao Wang Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/blk-flush.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-flush.c b/block/blk-flush.c index 4938bec8cfef..6603352879e7 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -402,7 +402,7 @@ static void mq_flush_data_end_io(struct request *rq, blk_status_t error) blk_flush_complete_seq(rq, fq, REQ_FSEQ_DATA, error); spin_unlock_irqrestore(&fq->mq_flush_lock, flags); - blk_mq_run_hw_queue(hctx, true); + blk_mq_sched_restart(hctx); } /** -- 2.19.1