Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp112056ybg; Mon, 8 Jun 2020 17:57:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZtV8u1cDDM4CMvzwVeDkG2A77gLUyEkSCRgYvoFq8JQ7wLh3qvAPQDogAYR9tcL4GtSgZ X-Received: by 2002:a05:6402:1ca2:: with SMTP id cz2mr23608343edb.15.1591664222494; Mon, 08 Jun 2020 17:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591664222; cv=none; d=google.com; s=arc-20160816; b=MraGXYfJL5a6OyGLczn3PgOwA2pzmQSwuc6+ztC+06E0UlgSDKKiG7uHtKyBN/buo9 P3YTnsmOSIqCemNwGK/hjF1vibOHIsHfXmHopHr0eneQyiiu89zvGComzhAxeMvXVD+j H564cPZjWm8dI0fUCPAiq7SX9990Kn1USbeyZdAKVbo0xtJzkIlfReKFzjcIl/35hxqR i0Nju2WLfjy1eY4HeYl/dZWTGxQcJ5h4p/jegMM7YP8xWiXiqdr0CzGf+AdD1abVnB4s 6S4HyIfJdiOhaNSvkLnjAGCQHf+UC52snIj5ChVZIni+BpFBKXFmQU0lngOlE/y8TMer /6xA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R6qGuPBKjGnflyBKbJhPXdTOsX0N7GQzN3qum0Sc/Os=; b=giQPr8bS7SGDJHZk3twRs4wlk0waO/pWLa2yvHLerovKs7z7iBAtA4PkD6PV8NrYZb RupTHIKU1EpAIWVjWsIm7bsIN0x39xI5304eyohDnr/UcDA12EMzYE3RUrjm5ZpuvnUV cOeWQf5JRrGkB8LU5ewkVbk9eFNyEEPhmJANMJfnxg2uo8HxWJ/eQ+96o48/+73ik4TM XGRDQ3q4s1T6KRxj8wTVyLnz8ZpAAV7j+xK2StYMxIQHa+xHznDy7/UZ4SnjVUaTI9/3 a5ProSh+VO2BBbIneHlcQPb0HxyBkxaIHSdv3UW8CBHr2afjC4bPzHV9PINpqnA7UJfg 38Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=scF3xgVf; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mh16si9530916ejb.129.2020.06.08.17.56.39; Mon, 08 Jun 2020 17:57:02 -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=scF3xgVf; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731523AbgFIAwx (ORCPT + 99 others); Mon, 8 Jun 2020 20:52:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:55872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728531AbgFHXJz (ORCPT ); Mon, 8 Jun 2020 19:09:55 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A352B20B80; Mon, 8 Jun 2020 23:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657794; bh=iJmO4xHRje2jpVeG+/TAXg5Tl4+PC6G/lsyYhTcVaoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=scF3xgVf19nDtR1M/xV7AS0fPaUdcvgkuPotxMjwwIyBy5faxGwepJojSyYsQQnTF EXaXT/Wan4Tc5zx6X8RJiEMSdkRKUrsihD9Ftgn6n7EJJjTA04dvmoq1bSvroLeyfj kBl5QoK5FGisrL1Kmfxr6VFqjRUGsL3iDi0mw3M0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Brian Foster , "Darrick J . Wong" , Christoph Hellwig , Allison Collins , Sasha Levin , linux-xfs@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 173/274] xfs: reset buffer write failure state on successful completion Date: Mon, 8 Jun 2020 19:04:26 -0400 Message-Id: <20200608230607.3361041-173-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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