Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2701808pxj; Mon, 31 May 2021 08:36:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHAstFDAiWhgOtpdZxf2nZr8WdXpBmj0x8TrPhQB4GsJrArmJqueFmAoiQwxbqMwLjUMgR X-Received: by 2002:a50:ef0a:: with SMTP id m10mr26465643eds.310.1622475364713; Mon, 31 May 2021 08:36:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622475364; cv=none; d=google.com; s=arc-20160816; b=CXD2iB05NtiIk79FJD3GMpvZqVDiNR4bABOUb7BXmzOyKRKS9IEDLG/KsksksjJJQq ZGtk0+AO5RPtxEFPR4Nsqk3Bs//Z8Y4qgwKgm0wVvbWZ3eEWhswstbCOZKm90qyymoij lnH7m5Lku229You0RDpkTtrPiLoBmpOkjpCGyiLly08KRbqH4PdC6euUZse6XyFUrxSM VnLnMRdejJ+v88DpY/FYUwYzcSlPI20QF+X/kvAOsOK3pf4ZqAwY57acmQQbGGqGvSVa wwcqpUqt4pYGlHGYoFl715s5hzGRk+KFNA6MtvXb6ofzv9ngeWQlFsw0FVZLcPPi7tN2 X2kw== 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=bMoFMdceMe1F41840maqJj3cGToa6pMQHH8XqPbdYWI=; b=kIIc7U/rYW09lKMveJwsBX20MFRPDO0YGollAbzVJ8RE+lxyXScD9x1OUwxWdN373m vdeeNjn1xcjjpEntEzNDxNYOMGjrtMugyUvg7SRjIMzAWcjCmD7wuialHuVp+bLd4WyS /9VM+2iazWrathe0eqlUVvFT4doN8Uj7X0R9pj3tkLv8QUkG5YYyRnjWZpjDfzXCmnKN XvUbHZczAK8MhxYUZuEyVmnSIH9dYXw57FdSjoV9hvqVUS38xtvp2PxSE9/LcKhcJGrl 8auhQeSScY/S5zpeSg9DudgCCv5Hr9Dq8JUWt+8FsiK8gs0X5yy/RRsjKI+8tuc9B0WK /kxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="o22TjB/7"; 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 bh4si15389980ejb.358.2021.05.31.08.35.42; Mon, 31 May 2021 08:36:04 -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="o22TjB/7"; 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 S234670AbhEaPeU (ORCPT + 99 others); Mon, 31 May 2021 11:34:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:43712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232198AbhEaOSC (ORCPT ); Mon, 31 May 2021 10:18:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 58BE961494; Mon, 31 May 2021 13:44:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468641; bh=UXce5rBV72IFJ3sK+JaRW192E2yXntiPK9VC/77MEWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o22TjB/7dujTseFYRv3W1vfLPR3DrTD+lZui4K53m2VAoiZYlda0wpf2ySUCh66v/ Ls/NDcN/67hZw3smhY9D4RAANoVEwPV3ejNhBtbYbMA7aC5tWC/YiqDi8pjhqjHg/5 w+nnE1H1IqvX7MCm5f2h6ukXgldXCEQak0ZTBScg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.4 069/177] NFS: Dont corrupt the value of pg_bytes_written in nfs_do_recoalesce() Date: Mon, 31 May 2021 15:13:46 +0200 Message-Id: <20210531130650.288542632@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130647.887605866@linuxfoundation.org> References: <20210531130647.887605866@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: Trond Myklebust commit 0d0ea309357dea0d85a82815f02157eb7fcda39f upstream. The value of mirror->pg_bytes_written should only be updated after a successful attempt to flush out the requests on the list. Fixes: a7d42ddb3099 ("nfs: add mirroring support to pgio layer") Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman --- fs/nfs/pagelist.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -1019,17 +1019,16 @@ static void nfs_pageio_doio(struct nfs_p { struct nfs_pgio_mirror *mirror = nfs_pgio_current_mirror(desc); - if (!list_empty(&mirror->pg_list)) { int error = desc->pg_ops->pg_doio(desc); if (error < 0) desc->pg_error = error; - else + if (list_empty(&mirror->pg_list)) { mirror->pg_bytes_written += mirror->pg_count; - } - if (list_empty(&mirror->pg_list)) { - mirror->pg_count = 0; - mirror->pg_base = 0; + mirror->pg_count = 0; + mirror->pg_base = 0; + mirror->pg_recoalesce = 0; + } } } @@ -1123,7 +1122,6 @@ static int nfs_do_recoalesce(struct nfs_ do { list_splice_init(&mirror->pg_list, &head); - mirror->pg_bytes_written -= mirror->pg_count; mirror->pg_count = 0; mirror->pg_base = 0; mirror->pg_recoalesce = 0;