Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp966713ybt; Fri, 19 Jun 2020 19:55:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzThTPyWL3mjzFxhmf1KLiKEP/e7NoBv7n6hfP44QdLZ5+SvRg8rCv5sD/KdvSf83fNMGVL X-Received: by 2002:a05:6402:cbc:: with SMTP id cn28mr6428301edb.220.1592621721203; Fri, 19 Jun 2020 19:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592621721; cv=none; d=google.com; s=arc-20160816; b=aaoY3VoHcYdrwxqptVHaAY7cySo/eDH3DMZ5ZlW50yRzCj+0oq91tJ4Xe8Jj7AyHkJ chPcQOu6+X448/6lpTdYoD/UcX6bAQbdL0nsW08wSWCfnXLdf4Ed0hXtjMlqXYrv0wHl lxUDfpCJk7ackzQwxKlX69TsV3Nvjv+8h1pC4FZq50uc8448a9VkXLWrJVBCgO3y9CY2 l/IGKM5bk5gM8xW0ZjN1YieO5K3T/etfQejhey4alSfodWkAHndAKC8+Hw5k+ZoyiimG vjilp3LmUXgX+cBSoEAKjUlj3/vL+ffexqkGY9Bw4sRfnSBzt8Rra62W8ZHRX6xwebGT JmsA== 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=R6qGuPBKjGnflyBKbJhPXdTOsX0N7GQzN3qum0Sc/Os=; b=f2rTCEU518U8T+bRAQOspz09puU/4HQDfzbXsCrA8yB2EvI3q+NsMe8ze4dVg1jh3o BYr+X8qmtM0seWFeSW6kICu7/KvIPN/YkmxMdDPkyI4Mo0JtkZiTR16WhcyjZtYGebMd 9LAJYigAq92rQZIjKDXdj8N6mU8cCMqkREOucq1fDutYw3e6jz7+KDTV7u55aU0A3tsk f/nQ7Dj5+H/LOgom8SlAum95KrAUIX0K/xffIg6w/yVMcT/Qt5b0nC7jS+utYpX/3B// MjEfQa2XKAUjg0b8r5d3bu2oS3pn46k/n0XulMZqVY7suLJHXzILCHmIuRu3ucCn/KbT Ix4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FRkthhK9; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h4si4903306ejg.735.2020.06.19.19.54.59; Fri, 19 Jun 2020 19:55:21 -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=@kernel.org header.s=default header.b=FRkthhK9; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405338AbgFSPwJ (ORCPT + 99 others); Fri, 19 Jun 2020 11:52:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:54968 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388863AbgFSPXZ (ORCPT ); Fri, 19 Jun 2020 11:23:25 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 BA866217A0; Fri, 19 Jun 2020 15:23:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592580204; bh=iJmO4xHRje2jpVeG+/TAXg5Tl4+PC6G/lsyYhTcVaoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FRkthhK9F7rw+TmYVpV2+XSpd1dlfcQoALChlxZftVwyXJGVqFwcpOmZhm+dCPBbd WQnIFRqAQVKxlCBQu5TKh4RvZBd2JGfFXP9lAZ0vJE4Gr9GeQRao+r7UIoq4rs3Als wegVx/yE5f/LN1U0/yPYHKt9PQRhL+iJmGZV82j8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Foster , "Darrick J. Wong" , Christoph Hellwig , Allison Collins , Sasha Levin Subject: [PATCH 5.7 162/376] xfs: reset buffer write failure state on successful completion Date: Fri, 19 Jun 2020 16:31:20 +0200 Message-Id: <20200619141717.989080183@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141710.350494719@linuxfoundation.org> References: <20200619141710.350494719@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Brian Foster [ Upstream commit b6983e80b03bd4fd42de71993b3ac7403edac758 ] The buffer write failure flag is intended to control the internal write retry that XFS has historically implemented to help mitigate the severity of transient I/O errors. The flag is set when a buffer is resubmitted from the I/O completion path due to a previous failure. It is checked on subsequent I/O completions to skip the internal retry and fall through to the higher level configurable error handling mechanism. The flag is cleared in the synchronous and delwri submission paths and also checked in various places to log write failure messages. There are a couple minor problems with the current usage of this flag. One is that we issue an internal retry after every submission from xfsaild due to how delwri submission clears the flag. This results in double the expected or configured number of write attempts when under sustained failures. Another more subtle issue is that the flag is never cleared on successful I/O completion. This can cause xfs_wait_buftarg() to suggest that dirty buffers are being thrown away due to the existence of the flag, when the reality is that the flag might still be set because the write succeeded on the retry. Clear the write failure flag on successful I/O completion to address both of these problems. This means that the internal retry attempt occurs once since the last time a buffer write failed and that various other contexts only see the flag set when the immediately previous write attempt has failed. Signed-off-by: Brian Foster Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Allison Collins Signed-off-by: Darrick J. Wong Signed-off-by: Sasha Levin --- fs/xfs/xfs_buf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 9ec3eaf1c618..afa73a19caa1 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1197,8 +1197,10 @@ xfs_buf_ioend( bp->b_ops->verify_read(bp); } - if (!bp->b_error) + if (!bp->b_error) { + bp->b_flags &= ~XBF_WRITE_FAIL; bp->b_flags |= XBF_DONE; + } if (bp->b_iodone) (*(bp->b_iodone))(bp); @@ -1258,7 +1260,7 @@ xfs_bwrite( bp->b_flags |= XBF_WRITE; bp->b_flags &= ~(XBF_ASYNC | XBF_READ | _XBF_DELWRI_Q | - XBF_WRITE_FAIL | XBF_DONE); + XBF_DONE); error = xfs_buf_submit(bp); if (error) @@ -1983,7 +1985,7 @@ xfs_buf_delwri_submit_buffers( * synchronously. Otherwise, drop the buffer from the delwri * queue and submit async. */ - bp->b_flags &= ~(_XBF_DELWRI_Q | XBF_WRITE_FAIL); + bp->b_flags &= ~_XBF_DELWRI_Q; bp->b_flags |= XBF_WRITE; if (wait_list) { bp->b_flags &= ~XBF_ASYNC; -- 2.25.1