Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2089135pxb; Mon, 12 Apr 2021 14:09:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzLEJWPazB7FNrB65nqK2xswBmJO8sDhOzmzheEI2O0SafjzUTlX2Yk+3sIcjPaqAUxuDe X-Received: by 2002:a17:907:9691:: with SMTP id hd17mr5727151ejc.205.1618261762169; Mon, 12 Apr 2021 14:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618261762; cv=none; d=google.com; s=arc-20160816; b=tp/tB25Aw/2JeMhQPAsTDTBg1mnyS0V+6GhYNfjYPxTtFSS5rSLdV5VDSNpaiiJVza OVidyiRkMVL7RYHE6C+7sQ7xT0l2TEqGk9j+AASpgG4onu8DUiZiPtvtT2C9VGqyT/uH 7+kqYKo3h5oxyW65CmFBxLOG5LR/F0uXrIYq9wB4gccU4fny/SbhTOoyppW5xpQskfJP EH2MABQehfAEJQ0+UXJRWiJ4XHdh9yMyrGe2CO04VHNihwQNYQZxRPs1nz+0IB3XjAMk qPMVo0shwUh9UyCN2uWPXdp8WG3RbbND2V7vFeMObtOHlDwppmXg8Fw7blAW4whFBWsL Z19A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IYNIuiXGIRz58PrmEb+bH3Ho+QtHQ2IDM2E0bLi0lJE=; b=Eqftogi4TlHFMMghQ3FEgNMMXC2CirE17barViIfTiAJ9TsyHddKYhkbBQHHl1DNat T9LuvJiTWsHAcnG11eKU38AZQgdZRuzHD0i3bDPEQsHeCSxOVt9xA2yjGLEf9lrk6z6v v1tELqL0OdWJ1mM/iTmNN6hwCr/WalgarhJtxbCxQ98qaimHkVosINg+/j2kMWMxntf6 Q/kscxdzCPTHQ3YeZx1zPQWCNtsoUWav5lANHXDAiEfGQCt2PEr0ZuuNtOpn49I8xPXQ 6ZgBYrcvb3quCfa48fzYecjPYKwMaaq4JssGKhPjVqhXua8XqDGTV38FJCo5pEc8NXTX Nvog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A7RvspYq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb2si8114745ejc.547.2021.04.12.14.08.58; Mon, 12 Apr 2021 14:09:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A7RvspYq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240132AbhDLJJz (ORCPT + 99 others); Mon, 12 Apr 2021 05:09:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:47054 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238746AbhDLIyc (ORCPT ); Mon, 12 Apr 2021 04:54:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AB67061355; Mon, 12 Apr 2021 08:52:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217568; bh=xPMfY9rYYc8/wV1y5ujmto9Q6t0sP9asxpzX3X6uuyQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A7RvspYqNKtbTlofxgJMopd4eCYZeyZl4kfB73sR5VdBKWYEDGNE0t4QWGxZyVP6u WlMUUKSaNKAJAWLjBlmjNbE33ogpLB2y5uRHCQ03Uu+L3ZwCR5ClrgM+esq2m9SzA+ ZjwwUsvariB4qI/w8D1s3Tz6ppW5RRXdDduPU+aY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Qiu , Jan Kara , Andrew Morton , Linus Torvalds Subject: [PATCH 5.10 026/188] fs: direct-io: fix missing sdio->boundary Date: Mon, 12 Apr 2021 10:39:00 +0200 Message-Id: <20210412084014.523279728@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084013.643370347@linuxfoundation.org> References: <20210412084013.643370347@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jack Qiu commit df41872b68601059dd4a84858952dcae58acd331 upstream. I encountered a hung task issue, but not a performance one. I run DIO on a device (need lba continuous, for example open channel ssd), maybe hungtask in below case: DIO: Checkpoint: get addr A(at boundary), merge into BIO, no submit because boundary missing flush dirty data(get addr A+1), wait IO(A+1) writeback timeout, because DIO(A) didn't submit get addr A+2 fail, because checkpoint is doing dio_send_cur_page() may clear sdio->boundary, so prevent it from missing a boundary. Link: https://lkml.kernel.org/r/20210322042253.38312-1-jack.qiu@huawei.com Fixes: b1058b981272 ("direct-io: submit bio after boundary buffer is added to it") Signed-off-by: Jack Qiu Reviewed-by: Jan Kara Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/direct-io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -810,6 +810,7 @@ submit_page_section(struct dio *dio, str struct buffer_head *map_bh) { int ret = 0; + int boundary = sdio->boundary; /* dio_send_cur_page may clear it */ if (dio->op == REQ_OP_WRITE) { /* @@ -848,10 +849,10 @@ submit_page_section(struct dio *dio, str sdio->cur_page_fs_offset = sdio->block_in_file << sdio->blkbits; out: /* - * If sdio->boundary then we want to schedule the IO now to + * If boundary then we want to schedule the IO now to * avoid metadata seeks. */ - if (sdio->boundary) { + if (boundary) { ret = dio_send_cur_page(dio, sdio, map_bh); if (sdio->bio) dio_bio_submit(dio, sdio);